diff options
| author | jave | 2014-12-31 12:24:10 +0100 |
|---|---|---|
| committer | jave | 2014-12-31 12:24:10 +0100 |
| commit | baba9e039136e183e055169ddd7ca1e983fc734f (patch) | |
| tree | 9168fb077980351a25ea3a112f2abd105a11099a /lisp | |
| parent | 4105b6a93047045553e10795742a808b805c85b7 (diff) | |
| parent | 25346768fac53687c97c213fb99ff18fa805b073 (diff) | |
| download | emacs-baba9e039136e183e055169ddd7ca1e983fc734f.tar.gz emacs-baba9e039136e183e055169ddd7ca1e983fc734f.zip | |
merge upstream
Diffstat (limited to 'lisp')
44 files changed, 1477 insertions, 609 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4c6b23dac0b..4203e05aed8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,324 @@ | |||
| 1 | 2014-12-30 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * Makefile.in (semantic): Simplify. | ||
| 4 | |||
| 5 | 2014-12-30 Juri Linkov <juri@linkov.net> | ||
| 6 | |||
| 7 | * net/eww.el (eww-isearch-next-buffer): New function. | ||
| 8 | (eww-mode): Set multi-isearch-next-buffer-function to it. | ||
| 9 | |||
| 10 | 2014-12-30 Dmitry Gutov <dgutov@yandex.ru> | ||
| 11 | |||
| 12 | * progmodes/xref.el (xref-find-definitions): Mention "no | ||
| 13 | identifier at point" case in the docstring. | ||
| 14 | |||
| 15 | * menu-bar.el (menu-bar-goto-uses-etags-p): New function. | ||
| 16 | (menu-bar-goto-menu): Use it to show or hide the `set-tags-name' | ||
| 17 | and `separator-tag-file' items. | ||
| 18 | |||
| 19 | 2014-12-29 Paul Eggert <eggert@cs.ucla.edu> | ||
| 20 | |||
| 21 | * obsolete/pc-select.el (pc-selection-mode): Use system-type. | ||
| 22 | This is instead of system-name, which is both wrong here and obsolete. | ||
| 23 | |||
| 24 | 2014-12-29 Dmitry Gutov <dgutov@yandex.ru> | ||
| 25 | |||
| 26 | * menu-bar.el (menu-bar-next-tag-other-window) | ||
| 27 | (menu-bar-next-tag): Remove. | ||
| 28 | |||
| 29 | 2014-12-29 K. Handa <handa@gnu.org> | ||
| 30 | |||
| 31 | * international/mule.el (make-translation-table-from-alist): | ||
| 32 | Accept nil or zero-length vector for FROM and TO. | ||
| 33 | |||
| 34 | 2014-12-29 Lars Ingebrigtsen <larsi@gnus.org> | ||
| 35 | |||
| 36 | * net/eww.el (eww-mode): Truncate overlong lines for prettier | ||
| 37 | display when resizing. | ||
| 38 | |||
| 39 | * net/shr.el (shr-width): Default to using the window width when | ||
| 40 | rendering. | ||
| 41 | |||
| 42 | 2014-12-29 Dmitry Gutov <dgutov@yandex.ru> | ||
| 43 | |||
| 44 | Unbreak jumping to an alias's definition. | ||
| 45 | |||
| 46 | * emacs-lisp/find-func.el (find-function-library): Return a pair | ||
| 47 | (ORIG-FUNCTION . LIBRARY) instead of just its second element. | ||
| 48 | (find-function-noselect): Use it. | ||
| 49 | |||
| 50 | * progmodes/elisp-mode.el (elisp--xref-identifier-file): Rename to | ||
| 51 | `elisp--xref-identifier-location', incorporate logic from | ||
| 52 | `elisp--xref-find-definitions', use the changed | ||
| 53 | `find-function-library' return value. | ||
| 54 | |||
| 55 | 2014-12-29 Juri Linkov <juri@linkov.net> | ||
| 56 | |||
| 57 | * comint.el (comint-history-isearch-message): Use field-beginning | ||
| 58 | instead of comint-line-beginning-position - that's more fixes for | ||
| 59 | http://lists.gnu.org/archive/html/emacs-devel/2014-12/msg00305.html | ||
| 60 | (comint-history-isearch-message): Fix args of isearch-message-prefix. | ||
| 61 | |||
| 62 | 2014-12-29 Juri Linkov <juri@linkov.net> | ||
| 63 | |||
| 64 | * vc/vc-dir.el (vc-dir-display-file): New command (bug#19450). | ||
| 65 | (vc-dir-mode-map): Bind it to "\C-o". | ||
| 66 | (vc-dir-menu-map): Add it to menu. | ||
| 67 | |||
| 68 | 2014-12-29 Dmitry Gutov <dgutov@yandex.ru> | ||
| 69 | |||
| 70 | * progmodes/etags.el (find-tag-other-window) | ||
| 71 | (find-tag-other-frame, find-tag-regexp, tags-loop-continue) | ||
| 72 | (tags-apropos): Declare obsolete. | ||
| 73 | |||
| 74 | * menu-bar.el (menu-bar-goto-menu): Replace all but one etags item | ||
| 75 | with xref ones. | ||
| 76 | |||
| 77 | 2014-12-28 Eli Zaretskii <eliz@gnu.org> | ||
| 78 | |||
| 79 | * international/mule.el (define-coding-system): Fix typos in the | ||
| 80 | doc string. | ||
| 81 | |||
| 82 | 2014-12-28 Kenichi Handa <handa@gnu.org> | ||
| 83 | |||
| 84 | * international/mule.el (define-coding-system): Improve the doc | ||
| 85 | string. | ||
| 86 | |||
| 87 | 2014-12-28 Ivan Shmakov <ivan@siamics.net> | ||
| 88 | |||
| 89 | * net/shr.el (shr-tag-table): Fix handling of tbody/header/footer | ||
| 90 | elements in tables (bug#19444). | ||
| 91 | |||
| 92 | * net/eww.el (eww-handle-link): Fix typo in "up" rel handling | ||
| 93 | (bug#19445). | ||
| 94 | |||
| 95 | 2014-12-28 Juri Linkov <juri@linkov.net> | ||
| 96 | |||
| 97 | * vc/compare-w.el: Require diff-mode for diff faces. | ||
| 98 | (compare-windows-removed, compare-windows-added): New faces | ||
| 99 | inheriting from diff faces. | ||
| 100 | (compare-windows): Define obsolete face alias. | ||
| 101 | (compare-windows-highlight): Replace face `compare-windows' with | ||
| 102 | new faces `compare-windows-added' and `compare-windows-removed' | ||
| 103 | (bug#19451). | ||
| 104 | (compare-windows-get-recent-window): Signal an error when | ||
| 105 | no other window is found (bug#19170). | ||
| 106 | |||
| 107 | 2014-12-27 Dmitry Gutov <dgutov@yandex.ru> | ||
| 108 | |||
| 109 | * progmodes/elisp-mode.el (elisp--xref-identifier-file): | ||
| 110 | Skip features that have no sources. | ||
| 111 | |||
| 112 | * simple.el (execute-extended-command): | ||
| 113 | When `suggest-key-bindings' is nil, don't. | ||
| 114 | |||
| 115 | 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> | ||
| 116 | |||
| 117 | python.el: Native readline completion. | ||
| 118 | |||
| 119 | * progmodes/python.el (python-shell-completion-native-disabled-interpreters) | ||
| 120 | (python-shell-completion-native-enable) | ||
| 121 | (python-shell-completion-native-output-timeout): New defcustoms. | ||
| 122 | (python-shell-completion-native-interpreter-disabled-p) | ||
| 123 | (python-shell-completion-native-try) | ||
| 124 | (python-shell-completion-native-setup) | ||
| 125 | (python-shell-completion-native-turn-off) | ||
| 126 | (python-shell-completion-native-turn-on) | ||
| 127 | (python-shell-completion-native-turn-on-maybe) | ||
| 128 | (python-shell-completion-native-turn-on-maybe-with-msg) | ||
| 129 | (python-shell-completion-native-toggle): New functions. | ||
| 130 | (python-shell-completion-native-get-completions): New function. | ||
| 131 | (python-shell-completion-at-point): Use it. | ||
| 132 | |||
| 133 | 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> | ||
| 134 | |||
| 135 | python.el: Enhance shell user interaction and deprecate | ||
| 136 | python-shell-get-or-create-process. | ||
| 137 | |||
| 138 | * progmodes/python.el | ||
| 139 | (python-shell-get-process-or-error): New function. | ||
| 140 | (python-shell-with-shell-buffer): Use it. | ||
| 141 | (python-shell-send-string, python-shell-send-region) | ||
| 142 | (python-shell-send-buffer, python-shell-send-defun) | ||
| 143 | (python-shell-send-file, python-shell-switch-to-shell): Use it. | ||
| 144 | Add argument MSG to display user-friendly message when no process | ||
| 145 | is running. | ||
| 146 | (python-shell-switch-to-shell): Call pop-to-buffer with NORECORD. | ||
| 147 | (python-shell-make-comint): Rename argument SHOW from POP. Use | ||
| 148 | display-buffer instead of pop-to-buffer. | ||
| 149 | (run-python): Doc fix. Return process. | ||
| 150 | (python-shell-get-or-create-process): Make obsolete. | ||
| 151 | |||
| 152 | 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> | ||
| 153 | |||
| 154 | * progmodes/python.el (python-shell-buffer-substring): Handle | ||
| 155 | cornercase when region sent starts at point-min. | ||
| 156 | |||
| 157 | 2014-12-27 Eli Zaretskii <eliz@gnu.org> | ||
| 158 | |||
| 159 | * language/misc-lang.el (composition-function-table): Add Syriac | ||
| 160 | characters and also ZWJ/ZWNJ. See | ||
| 161 | http://lists.gnu.org/archive/html/help-gnu-emacs/2014-12/msg00248.html | ||
| 162 | for the details. | ||
| 163 | |||
| 164 | 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> | ||
| 165 | |||
| 166 | python.el: Fix message when sending region. | ||
| 167 | |||
| 168 | * progmodes/python.el (python-shell-send-region): Rename argument | ||
| 169 | send-main from nomain. Fix message. | ||
| 170 | (python-shell-send-buffer): Rename argument send-main from arg. | ||
| 171 | |||
| 172 | 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> | ||
| 173 | |||
| 174 | python.el: Cleanup temp files even with eval errors. | ||
| 175 | |||
| 176 | * progmodes/python.el (python-shell-send-file): Make file-name | ||
| 177 | mandatory. Fix temp file removal in the majority of cases. | ||
| 178 | |||
| 179 | 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> | ||
| 180 | |||
| 181 | python.el: Handle file encoding for shell. | ||
| 182 | |||
| 183 | * progmodes/python.el (python-rx-constituents): Add coding-cookie. | ||
| 184 | (python-shell--save-temp-file): Write file with proper encoding. | ||
| 185 | (python-shell-buffer-substring): Add coding cookie for detected | ||
| 186 | encoding to generated content. Fix blank lines when removing | ||
| 187 | if-name-main block. | ||
| 188 | (python-shell-send-file): Handle file encoding. | ||
| 189 | (python-info-encoding-from-cookie) | ||
| 190 | (python-info-encoding): New functions. | ||
| 191 | |||
| 192 | 2014-12-27 Michael Albinus <michael.albinus@gmx.de> | ||
| 193 | |||
| 194 | * net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): | ||
| 195 | Use `tramp-rsh-end-of-line', it ought to be more robust. | ||
| 196 | |||
| 197 | 2014-12-27 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 198 | |||
| 199 | * progmodes/js.el (js-syntax-propertize): "return" can't be divided | ||
| 200 | (bug#19397). | ||
| 201 | |||
| 202 | 2014-12-27 Michael Albinus <michael.albinus@gmx.de> | ||
| 203 | |||
| 204 | * net/tramp.el (tramp-read-passwd): Ignore errors from `auth-source-*'. | ||
| 205 | |||
| 206 | * net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band): Use "\n" | ||
| 207 | as end-of-line delimeter for passwords, when running on MS Windows. | ||
| 208 | |||
| 209 | 2014-12-27 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 210 | |||
| 211 | * progmodes/sh-script.el (sh-set-shell): Don't change the global value | ||
| 212 | of indent-line-function (bug#19433). | ||
| 213 | |||
| 214 | 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> | ||
| 215 | |||
| 216 | Fix line numbers on Python shell. | ||
| 217 | * progmodes/python.el (python-shell--save-temp-file): Do not | ||
| 218 | append coding cookie. | ||
| 219 | (python-shell-send-string): Generalize for | ||
| 220 | python-shell-send-region. | ||
| 221 | (python--use-fake-loc): Delete var. | ||
| 222 | (python-shell-buffer-substring): Cleanup fake-loc logic. | ||
| 223 | (python-shell-send-region): Remove fake-loc logic, simplify. | ||
| 224 | |||
| 225 | 2014-12-27 Fabián Ezequiel Gallina <fgallina@gnu.org> | ||
| 226 | |||
| 227 | * progmodes/python.el (python-indent-post-self-insert-function): | ||
| 228 | Make colon to re-indent only for dedenters, handling | ||
| 229 | multiline-statements gracefully. | ||
| 230 | |||
| 231 | 2014-12-27 Michael Albinus <michael.albinus@gmx.de> | ||
| 232 | |||
| 233 | * net/tramp.el (tramp-handle-insert-file-contents): | ||
| 234 | Set `find-file-not-found-functions' in case of errors. (Bug#18623) | ||
| 235 | |||
| 236 | 2014-12-27 Michael Albinus <michael.albinus@gmx.de> | ||
| 237 | |||
| 238 | * net/tramp-sh.el (tramp-send-command-and-read): New optional | ||
| 239 | arg MARKER. | ||
| 240 | (tramp-get-remote-path): Use it. | ||
| 241 | |||
| 242 | 2014-12-27 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 243 | |||
| 244 | * lisp/subr.el (redisplay-dont-pause): Mark as obsolete. | ||
| 245 | |||
| 246 | 2014-12-27 Michael Albinus <michael.albinus@gmx.de> | ||
| 247 | |||
| 248 | * net/tramp.el (tramp-error-with-buffer): Call `message' properly. | ||
| 249 | (tramp-accept-process-output): Use nil as argument for | ||
| 250 | `accept-process-output', when there is a gateway prepended. | ||
| 251 | |||
| 252 | * net/tramp-gw.el (tramp-gw-open-connection): Suppress traces in | ||
| 253 | wrong debug buffer. | ||
| 254 | (tramp-gw-open-connection): Set process coding system 'binary. | ||
| 255 | (tramp-gw-open-network-stream): Handle HTTP error 403. | ||
| 256 | |||
| 257 | * net/tramp-sh.el (tramp-compute-multi-hops): Suppress traces in | ||
| 258 | wrong debug buffer. | ||
| 259 | (tramp-maybe-open-connection): Set connection property "gateway". | ||
| 260 | |||
| 261 | 2014-12-27 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 262 | |||
| 263 | * subr.el (sit-for): Tweak docstring (bug#19381). | ||
| 264 | |||
| 265 | 2014-12-27 Dmitry Gutov <dgutov@yandex.ru> | ||
| 266 | |||
| 267 | * vc/vc-git.el (vc-git-after-dir-status-stage): Move `up-to-date' | ||
| 268 | stage to after `diff-index' (bug#19386). | ||
| 269 | |||
| 270 | 2014-12-27 João Távora <joaotavora@gmail.com> | ||
| 271 | |||
| 272 | * textmodes/tex-mode.el (tex-insert-quote): Consider and respect | ||
| 273 | `electric-pair-mode' (bug#19356). | ||
| 274 | |||
| 275 | 2014-12-27 Dmitry Gutov <dgutov@yandex.ru> | ||
| 276 | |||
| 277 | elisp-xref-find: Don't create buffers eagerly. | ||
| 278 | |||
| 279 | * progmodes/elisp-mode.el (elisp--identifier-location): Fold back | ||
| 280 | into `elisp--company-location'. | ||
| 281 | (elisp--identifier-completion-table): Rename to | ||
| 282 | `elisp--identifier-completion-table', and do not include just any | ||
| 283 | symbols with a property list. | ||
| 284 | (elisp-completion-at-point): Revert the 2014-12-25 change. | ||
| 285 | (elisp--xref-identifier-file): New function. | ||
| 286 | (elisp--xref-find-definitions): Use it. | ||
| 287 | |||
| 288 | * emacs-lisp/find-func.el (find-function-library): New function, | ||
| 289 | extracted from `find-function-noselect'. | ||
| 290 | |||
| 291 | * progmodes/xref.el (xref-elisp-location): New class. | ||
| 292 | (xref-make-elisp-location): New function. | ||
| 293 | (xref-location-marker): New implementation. | ||
| 294 | |||
| 295 | 2014-12-27 Juri Linkov <juri@linkov.net> | ||
| 296 | |||
| 297 | * minibuffer.el (minibuffer-completion-help): | ||
| 298 | Use shrink-window-if-larger-than-buffer in window-height | ||
| 299 | when temp-buffer-resize-mode is nil. | ||
| 300 | |||
| 301 | * window.el (with-displayed-buffer-window): Remove window-height | ||
| 302 | from the action alist in the temp-buffer-window-show call | ||
| 303 | when window-height is handled explicitly afterwards (bug#19355). | ||
| 304 | |||
| 305 | 2014-12-27 Juri Linkov <juri@linkov.net> | ||
| 306 | |||
| 307 | Support subdirectories when saving places in dired. | ||
| 308 | * saveplace.el (toggle-save-place, save-place-to-alist) | ||
| 309 | (save-places-to-alist, save-place-dired-hook): | ||
| 310 | Use dired-current-directory instead of dired-directory (bug#19436). | ||
| 311 | (save-place-dired-hook): Add check for alist to make the new | ||
| 312 | format future-proof to allow other possible formats. | ||
| 313 | |||
| 314 | 2014-12-26 Fabián Ezequiel Gallina <fgallina@gnu.org> | ||
| 315 | |||
| 316 | python.el: Generate clearer shell buffer names. | ||
| 317 | |||
| 318 | * progmodes/python.el (python-shell-get-process-name) | ||
| 319 | (python-shell-internal-get-process-name): Use `buffer-name`. | ||
| 320 | (python-shell-internal-get-or-create-process): Simplify. | ||
| 321 | |||
| 1 | 2014-12-26 Dmitry Gutov <dgutov@yandex.ru> | 322 | 2014-12-26 Dmitry Gutov <dgutov@yandex.ru> |
| 2 | 323 | ||
| 3 | Add basic xref apropos implementation to elisp-mode. | 324 | Add basic xref apropos implementation to elisp-mode. |
| @@ -9,6 +330,11 @@ | |||
| 9 | 330 | ||
| 10 | * progmodes/xref.el (xref--show-xrefs): Use `user-error'. | 331 | * progmodes/xref.el (xref--show-xrefs): Use `user-error'. |
| 11 | 332 | ||
| 333 | 2014-12-25 Filipp Gunbin <fgunbin@fastmail.fm> | ||
| 334 | |||
| 335 | * dired-aux.el (dired-maybe-insert-subdir): Make | ||
| 336 | dired-maybe-insert-subdir always skip trivial files. | ||
| 337 | |||
| 12 | 2014-12-25 Helmut Eller <eller.helmut@gmail.com> | 338 | 2014-12-25 Helmut Eller <eller.helmut@gmail.com> |
| 13 | Dmitry Gutov <dgutov@yandex.ru> | 339 | Dmitry Gutov <dgutov@yandex.ru> |
| 14 | 340 | ||
| @@ -4645,12 +4971,6 @@ | |||
| 4645 | 4971 | ||
| 4646 | 2014-07-28 Fabián Ezequiel Gallina <fgallina@gnu.org> | 4972 | 2014-07-28 Fabián Ezequiel Gallina <fgallina@gnu.org> |
| 4647 | 4973 | ||
| 4648 | Prevent Python process shell buffer to pop twice. | ||
| 4649 | * progmodes/python.el (python-shell-switch-to-shell): Do not call | ||
| 4650 | pop-to-buffer. | ||
| 4651 | |||
| 4652 | 2014-07-28 Fabián Ezequiel Gallina <fgallina@gnu.org> | ||
| 4653 | |||
| 4654 | * progmodes/python.el | 4974 | * progmodes/python.el |
| 4655 | (python-shell-with-shell-buffer): New macro. | 4975 | (python-shell-with-shell-buffer): New macro. |
| 4656 | (python-shell-font-lock-get-or-create-buffer) | 4976 | (python-shell-font-lock-get-or-create-buffer) |
diff --git a/lisp/Makefile.in b/lisp/Makefile.in index f22ca69996b..ba2a2292cbd 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in | |||
| @@ -325,13 +325,8 @@ compile-clean: | |||
| 325 | leim: | 325 | leim: |
| 326 | $(MAKE) -C ../leim all EMACS="$(EMACS)" | 326 | $(MAKE) -C ../leim all EMACS="$(EMACS)" |
| 327 | 327 | ||
| 328 | # FIXME. Yuck. | ||
| 329 | semantic: | 328 | semantic: |
| 330 | case ${EMACS} in \ | 329 | $(MAKE) -C ../admin/grammars all EMACS="$(EMACS:.%=../.%)" |
| 331 | .*) EMACS="../${EMACS}" ;; \ | ||
| 332 | *) EMACS="${EMACS}" ;; \ | ||
| 333 | esac; \ | ||
| 334 | $(MAKE) -C ../admin/grammars all EMACS="$${EMACS}" | ||
| 335 | 330 | ||
| 336 | # Compile all Lisp files, but don't recompile those that are up to | 331 | # Compile all Lisp files, but don't recompile those that are up to |
| 337 | # date. Some .el files don't get compiled because they set the | 332 | # date. Some .el files don't get compiled because they set the |
diff --git a/lisp/comint.el b/lisp/comint.el index 3085052087c..4acaa30db91 100644 --- a/lisp/comint.el +++ b/lisp/comint.el | |||
| @@ -1532,14 +1532,20 @@ the function `isearch-message'." | |||
| 1532 | ;; the initial comint prompt. | 1532 | ;; the initial comint prompt. |
| 1533 | (if (overlayp comint-history-isearch-message-overlay) | 1533 | (if (overlayp comint-history-isearch-message-overlay) |
| 1534 | (move-overlay comint-history-isearch-message-overlay | 1534 | (move-overlay comint-history-isearch-message-overlay |
| 1535 | (save-excursion (forward-line 0) (point)) | 1535 | (save-excursion |
| 1536 | (comint-line-beginning-position)) | 1536 | (goto-char (field-beginning)) |
| 1537 | (forward-line 0) | ||
| 1538 | (point)) | ||
| 1539 | (field-beginning)) | ||
| 1537 | (setq comint-history-isearch-message-overlay | 1540 | (setq comint-history-isearch-message-overlay |
| 1538 | (make-overlay (save-excursion (forward-line 0) (point)) | 1541 | (make-overlay (save-excursion |
| 1539 | (comint-line-beginning-position))) | 1542 | (goto-char (field-beginning)) |
| 1543 | (forward-line 0) | ||
| 1544 | (point)) | ||
| 1545 | (field-beginning))) | ||
| 1540 | (overlay-put comint-history-isearch-message-overlay 'evaporate t)) | 1546 | (overlay-put comint-history-isearch-message-overlay 'evaporate t)) |
| 1541 | (overlay-put comint-history-isearch-message-overlay | 1547 | (overlay-put comint-history-isearch-message-overlay |
| 1542 | 'display (isearch-message-prefix c-q-hack ellipsis)) | 1548 | 'display (isearch-message-prefix ellipsis isearch-nonincremental)) |
| 1543 | (if (and comint-input-ring-index (not ellipsis)) | 1549 | (if (and comint-input-ring-index (not ellipsis)) |
| 1544 | ;; Display the current history index. | 1550 | ;; Display the current history index. |
| 1545 | (message "History item: %d" (1+ comint-input-ring-index)) | 1551 | (message "History item: %d" (1+ comint-input-ring-index)) |
diff --git a/lisp/desktop.el b/lisp/desktop.el index 75bced49c2f..6ca396a1132 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el | |||
| @@ -940,7 +940,7 @@ Frames with a non-nil `desktop-dont-save' parameter are not saved." | |||
| 940 | (and desktop-restore-frames | 940 | (and desktop-restore-frames |
| 941 | (frameset-save nil | 941 | (frameset-save nil |
| 942 | :app desktop--app-id | 942 | :app desktop--app-id |
| 943 | :name (concat user-login-name "@" system-name) | 943 | :name (concat user-login-name "@" (system-name)) |
| 944 | :predicate #'desktop--check-dont-save)))) | 944 | :predicate #'desktop--check-dont-save)))) |
| 945 | 945 | ||
| 946 | ;;;###autoload | 946 | ;;;###autoload |
diff --git a/lisp/dired.el b/lisp/dired.el index 909ba22985a..7f7251f29ce 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -3884,7 +3884,7 @@ Ask means pop up a menu for the user to select one of copy, move or link." | |||
| 3884 | 3884 | ||
| 3885 | ;;; Start of automatically extracted autoloads. | 3885 | ;;; Start of automatically extracted autoloads. |
| 3886 | 3886 | ||
| 3887 | ;;;### (autoloads nil "dired-aux" "dired-aux.el" "1448837b5f3e2b9ad63f723361f1e32e") | 3887 | ;;;### (autoloads nil "dired-aux" "dired-aux.el" "73269f48e7fe2fd0ac580fd69252b33a") |
| 3888 | ;;; Generated autoloads from dired-aux.el | 3888 | ;;; Generated autoloads from dired-aux.el |
| 3889 | 3889 | ||
| 3890 | (autoload 'dired-diff "dired-aux" "\ | 3890 | (autoload 'dired-diff "dired-aux" "\ |
diff --git a/lisp/dnd.el b/lisp/dnd.el index 73b531dfd16..3fda471497f 100644 --- a/lisp/dnd.el +++ b/lisp/dnd.el | |||
| @@ -122,17 +122,18 @@ Return nil if URI is not a local file." | |||
| 122 | 122 | ||
| 123 | ;; The hostname may be our hostname, in that case, convert to a local | 123 | ;; The hostname may be our hostname, in that case, convert to a local |
| 124 | ;; file. Otherwise return nil. TODO: How about an IP-address as hostname? | 124 | ;; file. Otherwise return nil. TODO: How about an IP-address as hostname? |
| 125 | (let ((hostname (when (string-match "^file://\\([^/]*\\)" uri) | 125 | (let ((sysname (system-name))) |
| 126 | (let ((hostname (when (string-match "^file://\\([^/]*\\)" uri) | ||
| 126 | (downcase (match-string 1 uri)))) | 127 | (downcase (match-string 1 uri)))) |
| 127 | (system-name-no-dot | 128 | (sysname-no-dot |
| 128 | (downcase (if (string-match "^[^\\.]+" system-name) | 129 | (downcase (if (string-match "^[^\\.]+" sysname) |
| 129 | (match-string 0 system-name) | 130 | (match-string 0 sysname) |
| 130 | system-name)))) | 131 | sysname)))) |
| 131 | (when (and hostname | 132 | (when (and hostname |
| 132 | (or (string-equal "localhost" hostname) | 133 | (or (string-equal "localhost" hostname) |
| 133 | (string-equal (downcase system-name) hostname) | 134 | (string-equal (downcase sysname) hostname) |
| 134 | (string-equal system-name-no-dot hostname))) | 135 | (string-equal sysname-no-dot hostname))) |
| 135 | (concat "file://" (substring uri (+ 7 (length hostname))))))) | 136 | (concat "file://" (substring uri (+ 7 (length hostname)))))))) |
| 136 | 137 | ||
| 137 | (defsubst dnd-unescape-uri (uri) | 138 | (defsubst dnd-unescape-uri (uri) |
| 138 | (replace-regexp-in-string | 139 | (replace-regexp-in-string |
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index c372117b104..3131be09eb1 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el | |||
| @@ -311,6 +311,45 @@ The search is done in the source for library LIBRARY." | |||
| 311 | (cons (current-buffer) (point))) | 311 | (cons (current-buffer) (point))) |
| 312 | (cons (current-buffer) nil)))))))) | 312 | (cons (current-buffer) nil)))))))) |
| 313 | 313 | ||
| 314 | (defun find-function-library (function &optional lisp-only verbose) | ||
| 315 | "Return the pair (ORIG-FUNCTION . LIBRARY) for FUNCTION. | ||
| 316 | |||
| 317 | ORIG-FUNCTION is the original name, after removing all advice and | ||
| 318 | resolving aliases. LIBRARY is an absolute file name, a relative | ||
| 319 | file name inside the C sources directory, or a name of an | ||
| 320 | autoloaded feature. | ||
| 321 | |||
| 322 | If ORIG-FUNCTION is a built-in function and LISP-ONLY is non-nil, | ||
| 323 | signal an error. | ||
| 324 | |||
| 325 | If VERBOSE is non-nil, and FUNCTION is an alias, display a | ||
| 326 | message about the whole chain of aliases." | ||
| 327 | (let ((def (symbol-function (find-function-advised-original function))) | ||
| 328 | aliases) | ||
| 329 | ;; FIXME for completeness, it might be nice to print something like: | ||
| 330 | ;; foo (which is advised), which is an alias for bar (which is advised). | ||
| 331 | (while (symbolp def) | ||
| 332 | (or (eq def function) | ||
| 333 | (not verbose) | ||
| 334 | (if aliases | ||
| 335 | (setq aliases (concat aliases | ||
| 336 | (format ", which is an alias for `%s'" | ||
| 337 | (symbol-name def)))) | ||
| 338 | (setq aliases (format "`%s' is an alias for `%s'" | ||
| 339 | function (symbol-name def))))) | ||
| 340 | (setq function (symbol-function (find-function-advised-original function)) | ||
| 341 | def (symbol-function (find-function-advised-original function)))) | ||
| 342 | (if aliases | ||
| 343 | (message "%s" aliases)) | ||
| 344 | (cons function | ||
| 345 | (cond | ||
| 346 | ((autoloadp def) (nth 1 def)) | ||
| 347 | ((subrp def) | ||
| 348 | (if lisp-only | ||
| 349 | (error "%s is a built-in function" function)) | ||
| 350 | (help-C-file-name def 'subr)) | ||
| 351 | ((symbol-file function 'defun)))))) | ||
| 352 | |||
| 314 | ;;;###autoload | 353 | ;;;###autoload |
| 315 | (defun find-function-noselect (function &optional lisp-only) | 354 | (defun find-function-noselect (function &optional lisp-only) |
| 316 | "Return a pair (BUFFER . POINT) pointing to the definition of FUNCTION. | 355 | "Return a pair (BUFFER . POINT) pointing to the definition of FUNCTION. |
| @@ -329,30 +368,8 @@ searched for in `find-function-source-path' if non-nil, otherwise | |||
| 329 | in `load-path'." | 368 | in `load-path'." |
| 330 | (if (not function) | 369 | (if (not function) |
| 331 | (error "You didn't specify a function")) | 370 | (error "You didn't specify a function")) |
| 332 | (let ((def (symbol-function (find-function-advised-original function))) | 371 | (let ((func-lib (find-function-library function lisp-only t))) |
| 333 | aliases) | 372 | (find-function-search-for-symbol (car func-lib) nil (cdr func-lib)))) |
| 334 | ;; FIXME for completeness, it might be nice to print something like: | ||
| 335 | ;; foo (which is advised), which is an alias for bar (which is advised). | ||
| 336 | (while (symbolp def) | ||
| 337 | (or (eq def function) | ||
| 338 | (if aliases | ||
| 339 | (setq aliases (concat aliases | ||
| 340 | (format ", which is an alias for `%s'" | ||
| 341 | (symbol-name def)))) | ||
| 342 | (setq aliases (format "`%s' is an alias for `%s'" | ||
| 343 | function (symbol-name def))))) | ||
| 344 | (setq function (symbol-function (find-function-advised-original function)) | ||
| 345 | def (symbol-function (find-function-advised-original function)))) | ||
| 346 | (if aliases | ||
| 347 | (message "%s" aliases)) | ||
| 348 | (let ((library | ||
| 349 | (cond ((autoloadp def) (nth 1 def)) | ||
| 350 | ((subrp def) | ||
| 351 | (if lisp-only | ||
| 352 | (error "%s is a built-in function" function)) | ||
| 353 | (help-C-file-name def 'subr)) | ||
| 354 | ((symbol-file function 'defun))))) | ||
| 355 | (find-function-search-for-symbol function nil library)))) | ||
| 356 | 373 | ||
| 357 | (defun find-function-read (&optional type) | 374 | (defun find-function-read (&optional type) |
| 358 | "Read and return an interned symbol, defaulting to the one near point. | 375 | "Read and return an interned symbol, defaulting to the one near point. |
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 6f0ea0f57de..0007b15a76a 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-12-29 Lars Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * mm-decode.el (mm-shr): Bind `shr-width' to `fill-column' so that | ||
| 4 | lines don't get overlong when responding. | ||
| 5 | |||
| 1 | 2014-12-18 Paul Eggert <eggert@cs.ucla.edu> | 6 | 2014-12-18 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 7 | ||
| 3 | * registry.el (registry-db): Set default slot later. | 8 | * registry.el (registry-db): Set default slot later. |
diff --git a/lisp/gnus/gnus-cloud.el b/lisp/gnus/gnus-cloud.el index ec016eeeb77..a42bcc06e94 100644 --- a/lisp/gnus/gnus-cloud.el +++ b/lisp/gnus/gnus-cloud.el | |||
| @@ -329,6 +329,15 @@ | |||
| 329 | (defun gnus-cloud-server-p (server) | 329 | (defun gnus-cloud-server-p (server) |
| 330 | (member server gnus-cloud-covered-servers)) | 330 | (member server gnus-cloud-covered-servers)) |
| 331 | 331 | ||
| 332 | (defun gnus-cloud-collect-full-newsrc () | ||
| 333 | (let ((infos nil)) | ||
| 334 | (dolist (info (cdr gnus-newsrc-alist)) | ||
| 335 | (when (gnus-cloud-server-p | ||
| 336 | (gnus-method-to-server | ||
| 337 | (gnus-find-method-for-group (gnus-info-group info)))) | ||
| 338 | (push info infos))) | ||
| 339 | )) | ||
| 340 | |||
| 332 | (provide 'gnus-cloud) | 341 | (provide 'gnus-cloud) |
| 333 | 342 | ||
| 334 | ;;; gnus-cloud.el ends here | 343 | ;;; gnus-cloud.el ends here |
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index d58a2922217..ee5d824a852 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el | |||
| @@ -5849,7 +5849,7 @@ give as trustworthy answer as possible." | |||
| 5849 | 5849 | ||
| 5850 | (defun message-make-fqdn () | 5850 | (defun message-make-fqdn () |
| 5851 | "Return user's fully qualified domain name." | 5851 | "Return user's fully qualified domain name." |
| 5852 | (let* ((system-name (system-name)) | 5852 | (let* ((sysname (system-name)) |
| 5853 | (user-mail (message-user-mail-address)) | 5853 | (user-mail (message-user-mail-address)) |
| 5854 | (user-domain | 5854 | (user-domain |
| 5855 | (if (and user-mail | 5855 | (if (and user-mail |
| @@ -5863,10 +5863,10 @@ give as trustworthy answer as possible." | |||
| 5863 | (not (string-match message-bogus-system-names message-user-fqdn))) | 5863 | (not (string-match message-bogus-system-names message-user-fqdn))) |
| 5864 | ;; `message-user-fqdn' seems to be valid | 5864 | ;; `message-user-fqdn' seems to be valid |
| 5865 | message-user-fqdn) | 5865 | message-user-fqdn) |
| 5866 | ((and (string-match message-valid-fqdn-regexp system-name) | 5866 | ((and (string-match message-valid-fqdn-regexp sysname) |
| 5867 | (not (string-match message-bogus-system-names system-name))) | 5867 | (not (string-match message-bogus-system-names sysname))) |
| 5868 | ;; `system-name' returned the right result. | 5868 | ;; `system-name' returned the right result. |
| 5869 | system-name) | 5869 | sysname) |
| 5870 | ;; Try `mail-host-address'. | 5870 | ;; Try `mail-host-address'. |
| 5871 | ((and (boundp 'mail-host-address) | 5871 | ((and (boundp 'mail-host-address) |
| 5872 | (stringp mail-host-address) | 5872 | (stringp mail-host-address) |
| @@ -5881,7 +5881,7 @@ give as trustworthy answer as possible." | |||
| 5881 | user-domain) | 5881 | user-domain) |
| 5882 | ;; Default to this bogus thing. | 5882 | ;; Default to this bogus thing. |
| 5883 | (t | 5883 | (t |
| 5884 | (concat system-name | 5884 | (concat sysname |
| 5885 | ".i-did-not-set--mail-host-address--so-tickle-me"))))) | 5885 | ".i-did-not-set--mail-host-address--so-tickle-me"))))) |
| 5886 | 5886 | ||
| 5887 | (defun message-make-domain () | 5887 | (defun message-make-domain () |
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index f5b4d7cba88..3913ecc0b4e 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el | |||
| @@ -1814,6 +1814,7 @@ If RECURSIVE, search recursively." | |||
| 1814 | ;; Require since we bind its variables. | 1814 | ;; Require since we bind its variables. |
| 1815 | (require 'shr) | 1815 | (require 'shr) |
| 1816 | (let ((article-buffer (current-buffer)) | 1816 | (let ((article-buffer (current-buffer)) |
| 1817 | (shr-width fill-column) | ||
| 1817 | (shr-content-function (lambda (id) | 1818 | (shr-content-function (lambda (id) |
| 1818 | (let ((handle (mm-get-content-id id))) | 1819 | (let ((handle (mm-get-content-id id))) |
| 1819 | (when handle | 1820 | (when handle |
diff --git a/lisp/gnus/nnvirtual.el b/lisp/gnus/nnvirtual.el index f67943a336a..61bf5560e2e 100644 --- a/lisp/gnus/nnvirtual.el +++ b/lisp/gnus/nnvirtual.el | |||
| @@ -99,7 +99,7 @@ component group will show up when you enter the virtual group.") | |||
| 99 | (let ((vbuf (nnheader-set-temp-buffer | 99 | (let ((vbuf (nnheader-set-temp-buffer |
| 100 | (get-buffer-create " *virtual headers*"))) | 100 | (get-buffer-create " *virtual headers*"))) |
| 101 | (carticles (nnvirtual-partition-sequence articles)) | 101 | (carticles (nnvirtual-partition-sequence articles)) |
| 102 | (system-name (system-name)) | 102 | (sysname (system-name)) |
| 103 | cgroup carticle article result prefix) | 103 | cgroup carticle article result prefix) |
| 104 | (while carticles | 104 | (while carticles |
| 105 | (setq cgroup (caar carticles)) | 105 | (setq cgroup (caar carticles)) |
| @@ -151,7 +151,7 @@ component group will show up when you enter the virtual group.") | |||
| 151 | ;; and clean up the xrefs. | 151 | ;; and clean up the xrefs. |
| 152 | (princ article nntp-server-buffer) | 152 | (princ article nntp-server-buffer) |
| 153 | (nnvirtual-update-xref-header cgroup carticle | 153 | (nnvirtual-update-xref-header cgroup carticle |
| 154 | prefix system-name) | 154 | prefix sysname) |
| 155 | (forward-line 1)) | 155 | (forward-line 1)) |
| 156 | ) | 156 | ) |
| 157 | 157 | ||
| @@ -378,7 +378,7 @@ component group will show up when you enter the virtual group.") | |||
| 378 | (mapc 'nnheader-insert-nov headers)))) | 378 | (mapc 'nnheader-insert-nov headers)))) |
| 379 | 379 | ||
| 380 | 380 | ||
| 381 | (defun nnvirtual-update-xref-header (group article prefix system-name) | 381 | (defun nnvirtual-update-xref-header (group article prefix sysname) |
| 382 | "Edit current NOV header in current buffer to have an xref to the component group, and also server prefix any existing xref lines." | 382 | "Edit current NOV header in current buffer to have an xref to the component group, and also server prefix any existing xref lines." |
| 383 | ;; Move to beginning of Xref field, creating a slot if needed. | 383 | ;; Move to beginning of Xref field, creating a slot if needed. |
| 384 | (beginning-of-line) | 384 | (beginning-of-line) |
| @@ -393,7 +393,7 @@ component group will show up when you enter the virtual group.") | |||
| 393 | (forward-char -1) | 393 | (forward-char -1) |
| 394 | (delete-char 1)) | 394 | (delete-char 1)) |
| 395 | 395 | ||
| 396 | (insert "Xref: " system-name " " group ":") | 396 | (insert "Xref: " sysname " " group ":") |
| 397 | (princ article (current-buffer)) | 397 | (princ article (current-buffer)) |
| 398 | (insert " ") | 398 | (insert " ") |
| 399 | 399 | ||
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index bb8111e416f..392ecff021a 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -593,6 +593,29 @@ as the single-shift area.") | |||
| 593 | The remaining arguments must come in pairs ATTRIBUTE VALUE. ATTRIBUTE | 593 | The remaining arguments must come in pairs ATTRIBUTE VALUE. ATTRIBUTE |
| 594 | may be any symbol. | 594 | may be any symbol. |
| 595 | 595 | ||
| 596 | A coding system specifies a rule to decode (i.e. to convert a | ||
| 597 | byte sequence to a character sequence) and a rule to encode (the | ||
| 598 | opposite of decoding). | ||
| 599 | |||
| 600 | The decoding is done by at most 3 steps; the first is to convert | ||
| 601 | a byte sequence to a character sequence by one of Emacs' | ||
| 602 | internal routines specified by `:coding-type' attribute. The | ||
| 603 | optional second step is to convert the character sequence (the | ||
| 604 | result of the first step) by a translation table specified | ||
| 605 | by `:decode-translation-table' attribute. The optional third step | ||
| 606 | is to convert the above result by a Lisp function specified | ||
| 607 | by `:post-read-conversion' attribute. | ||
| 608 | |||
| 609 | The encoding is done by at most 3 steps, which are the reverse | ||
| 610 | of the decoding steps. The optional first step converts a | ||
| 611 | character sequence to another character sequence by a Lisp | ||
| 612 | function specified by `:pre-write-conversion' attribute. The | ||
| 613 | optional second step converts the above result by a translation | ||
| 614 | table specified by `:encode-translation-table' attribute. The | ||
| 615 | third step converts the above result to a byte sequence by one | ||
| 616 | of the Emacs's internal routines specified by the `:coding-type' | ||
| 617 | attribute. | ||
| 618 | |||
| 596 | The following attributes have special meanings. Those labeled as | 619 | The following attributes have special meanings. Those labeled as |
| 597 | \"(required)\" should not be omitted. | 620 | \"(required)\" should not be omitted. |
| 598 | 621 | ||
| @@ -602,27 +625,72 @@ VALUE is a character to display on mode line for the coding system. | |||
| 602 | 625 | ||
| 603 | `:coding-type' (required) | 626 | `:coding-type' (required) |
| 604 | 627 | ||
| 605 | VALUE must be one of `charset', `utf-8', `utf-16', `iso-2022', | 628 | VALUE specifies the format of byte sequence the coding system |
| 606 | `emacs-mule', `shift-jis', `ccl', `raw-text', `undecided'. | 629 | decodes and encodes to. It must be one of `charset', `utf-8', |
| 630 | `utf-16', `iso-2022', `emacs-mule', `shift-jis', `ccl', | ||
| 631 | `raw-text', `undecided'. | ||
| 632 | |||
| 633 | If VALUE is `charset', the coding system is for handling a | ||
| 634 | byte sequence in which each byte or every two- to four-byte | ||
| 635 | sequence represents a character code of a charset specified | ||
| 636 | by the `:charset-list' attribute. | ||
| 637 | |||
| 638 | If VALUE is `utf-8', the coding system is for handling Unicode | ||
| 639 | UTF-8 byte sequences. See also the documentation of the | ||
| 640 | attribute `:bom'. | ||
| 641 | |||
| 642 | If VALUE is `utf-16', the coding system is for handling Unicode | ||
| 643 | UTF-16 byte sequences. See also the documentation of the | ||
| 644 | attributes :bom and `:endian'. | ||
| 645 | |||
| 646 | If VALUE is `iso-2022', the coding system is for handling byte | ||
| 647 | sequences conforming to ISO/IEC 2022. See also the documentation | ||
| 648 | of the attributes `:charset-list', `:flags', and `:designation'. | ||
| 649 | |||
| 650 | If VALUE is `emacs-mule', the coding system is for handling | ||
| 651 | byte sequences which Emacs 20 and 21 used for their internal | ||
| 652 | representation of characters. | ||
| 653 | |||
| 654 | If VALUE is `shift-jis', the coding system is for handling byte | ||
| 655 | sequences of Shift_JIS format. See also the attribute `:charset-list'. | ||
| 656 | |||
| 657 | If VALUE is `ccl', the coding system uses CCL programs to decode | ||
| 658 | and encode byte sequences. The CCL programs must be | ||
| 659 | specified by the attributes `:ccl-decoder' and `:ccl-encoder'. | ||
| 660 | |||
| 661 | If VALUE is `raw-text', the coding system decodes byte sequences | ||
| 662 | without any conversions. | ||
| 607 | 663 | ||
| 608 | `:eol-type' | 664 | `:eol-type' |
| 609 | 665 | ||
| 610 | VALUE is the EOL (end-of-line) format of the coding system. It must be | 666 | VALUE is the EOL (end-of-line) format of the coding system. It must be |
| 611 | one of `unix', `dos', `mac'. The symbol `unix' means Unix-like EOL | 667 | one of `unix', `dos', `mac'. The symbol `unix' means Unix-like EOL |
| 612 | \(i.e. single LF), `dos' means DOS-like EOL \(i.e. sequence of CR LF), | 668 | \(i.e. a single LF character), `dos' means DOS-like EOL \(i.e. a sequence |
| 613 | and `mac' means Mac-like EOL \(i.e. single CR). If omitted, Emacs | 669 | of CR followed by LF), and `mac' means Mac-like EOL \(i.e. a single CR). |
| 614 | detects the EOL format automatically when decoding. | 670 | If omitted, Emacs detects the EOL format automatically when decoding. |
| 671 | |||
| 672 | `:charset-list' (required if `:coding-type' is `charset' or `shift-jis') | ||
| 673 | |||
| 674 | VALUE must be a list of charsets supported by the coding system. | ||
| 675 | |||
| 676 | If `coding-type:' is `charset', then on decoding and encoding by the | ||
| 677 | coding system, if a character belongs to multiple charsets in the | ||
| 678 | list, a charset that comes first in the list is selected. | ||
| 615 | 679 | ||
| 616 | `:charset-list' | 680 | If `:coding-type' is `iso-2022', VALUE may be `iso-2022', which |
| 681 | indicates that the coding system supports all ISO-2022 based | ||
| 682 | charsets. | ||
| 617 | 683 | ||
| 618 | VALUE must be a list of charsets supported by the coding system. On | 684 | If `:coding-type' is `shift-jis', VALUE must be a list of three |
| 619 | encoding by the coding system, if a character belongs to multiple | 685 | to four charsets supported by Shift_JIS encoding scheme. The |
| 620 | charsets in the list, a charset that comes earlier in the list is | 686 | first charset (one dimension) is for code space 0x00..0x7F, the |
| 621 | selected. If `:coding-type' is `iso-2022', VALUE may be `iso-2022', | 687 | second (one dimension) for 0xA1..0xDF, the third (two dimension) |
| 622 | which indicates that the coding system supports all ISO-2022 based | 688 | for 0x8140..0xEFFC, the optional fourth (three dimension) for |
| 623 | charsets. If `:coding-type' is `emacs-mule', VALUE may be | 689 | 0xF040..0xFCFC. |
| 624 | `emacs-mule', which indicates that the coding system supports all | 690 | |
| 625 | charsets that have the `:emacs-mule-id' property. | 691 | If `:coding-type' is `emacs-mule', VALUE may be `emacs-mule', |
| 692 | which indicates that the coding system supports all charsets that | ||
| 693 | have the `:emacs-mule-id' property. | ||
| 626 | 694 | ||
| 627 | `:ascii-compatible-p' | 695 | `:ascii-compatible-p' |
| 628 | 696 | ||
| @@ -643,9 +711,9 @@ VALUE must be a translation table to use on encoding. | |||
| 643 | VALUE must be a function to call after some text is inserted and | 711 | VALUE must be a function to call after some text is inserted and |
| 644 | decoded by the coding system itself and before any functions in | 712 | decoded by the coding system itself and before any functions in |
| 645 | `after-insert-functions' are called. This function is passed one | 713 | `after-insert-functions' are called. This function is passed one |
| 646 | argument; the number of characters in the text to convert, with | 714 | argument: the number of characters in the text to convert, with |
| 647 | point at the start of the text. The function should leave point | 715 | point at the start of the text. The function should leave point |
| 648 | the same, and return the new character count. | 716 | unchanged, and should return the new character count. |
| 649 | 717 | ||
| 650 | `:pre-write-conversion' | 718 | `:pre-write-conversion' |
| 651 | 719 | ||
| @@ -674,7 +742,7 @@ to lower case. | |||
| 674 | `:mime-text-unsuitable' | 742 | `:mime-text-unsuitable' |
| 675 | 743 | ||
| 676 | VALUE non-nil means the `:mime-charset' property names a charset which | 744 | VALUE non-nil means the `:mime-charset' property names a charset which |
| 677 | is unsuitable for the top-level media type \"text\". | 745 | is unsuitable for the top-level media of type \"text\". |
| 678 | 746 | ||
| 679 | `:flags' | 747 | `:flags' |
| 680 | 748 | ||
| @@ -704,8 +772,8 @@ This attribute is meaningful only when `:coding-type' is `iso-2022'. | |||
| 704 | 772 | ||
| 705 | `:bom' | 773 | `:bom' |
| 706 | 774 | ||
| 707 | This attributes specifies whether the coding system uses a `byte order | 775 | This attributes specifies whether the coding system uses a \"byte order |
| 708 | mark'. VALUE must be nil, t, or cons of coding systems whose | 776 | mark\". VALUE must be nil, t, or a cons cell of coding systems whose |
| 709 | `:coding-type' is `utf-16' or `utf-8'. | 777 | `:coding-type' is `utf-16' or `utf-8'. |
| 710 | 778 | ||
| 711 | If the value is nil, on decoding, don't treat the first two-byte as | 779 | If the value is nil, on decoding, don't treat the first two-byte as |
| @@ -714,9 +782,9 @@ BOM, and on encoding, don't produce BOM bytes. | |||
| 714 | If the value is t, on decoding, skip the first two-byte as BOM, and on | 782 | If the value is t, on decoding, skip the first two-byte as BOM, and on |
| 715 | encoding, produce BOM bytes according to the value of `:endian'. | 783 | encoding, produce BOM bytes according to the value of `:endian'. |
| 716 | 784 | ||
| 717 | If the value is cons, on decoding, check the first two-byte. If they | 785 | If the value is a cons cell, on decoding, check the first two bytes. |
| 718 | are 0xFE 0xFF, use the car part coding system of the value. If they | 786 | If they are 0xFE 0xFF, use the car part coding system of the value. |
| 719 | are 0xFF 0xFE, use the cdr part coding system of the value. | 787 | If they are 0xFF 0xFE, use the cdr part coding system of the value. |
| 720 | Otherwise, treat them as bytes for a normal character. On encoding, | 788 | Otherwise, treat them as bytes for a normal character. On encoding, |
| 721 | produce BOM bytes according to the value of `:endian'. | 789 | produce BOM bytes according to the value of `:endian'. |
| 722 | 790 | ||
| @@ -730,17 +798,17 @@ little-endian respectively. The default value is `big'. | |||
| 730 | 798 | ||
| 731 | This attribute is meaningful only when `:coding-type' is `utf-16'. | 799 | This attribute is meaningful only when `:coding-type' is `utf-16'. |
| 732 | 800 | ||
| 733 | `:ccl-decoder' | 801 | `:ccl-decoder' (required if :coding-type is `ccl') |
| 734 | 802 | ||
| 735 | VALUE is a symbol representing the registered CCL program used for | 803 | VALUE is a CCL program name defined by `define-ccl-program'. The |
| 736 | decoding. This attribute is meaningful only when `:coding-type' is | 804 | CCL program reads a byte sequence and writes a character sequence |
| 737 | `ccl'. | 805 | as a decoding result. |
| 738 | 806 | ||
| 739 | `:ccl-encoder' | 807 | `:ccl-encoder' (required if :coding-type is `ccl') |
| 740 | 808 | ||
| 741 | VALUE is a symbol representing the registered CCL program used for | 809 | VALUE is a CCL program name defined by `define-ccl-program'. The |
| 742 | encoding. This attribute is meaningful only when `:coding-type' is | 810 | CCL program reads a character sequence and writes a byte sequence |
| 743 | `ccl'. | 811 | as an encoding result. |
| 744 | 812 | ||
| 745 | `:inhibit-null-byte-detection' | 813 | `:inhibit-null-byte-detection' |
| 746 | 814 | ||
| @@ -2249,7 +2317,13 @@ ALIST is an alist, each element has the form (FROM . TO). | |||
| 2249 | FROM and TO are a character or a vector of characters. | 2317 | FROM and TO are a character or a vector of characters. |
| 2250 | If FROM is a character, that character is translated to TO. | 2318 | If FROM is a character, that character is translated to TO. |
| 2251 | If FROM is a vector of characters, that sequence is translated to TO. | 2319 | If FROM is a vector of characters, that sequence is translated to TO. |
| 2252 | The first extra-slot of the value is a translation table for reverse mapping." | 2320 | The first extra-slot of the value is a translation table for reverse mapping. |
| 2321 | |||
| 2322 | FROM and TO may be nil. If TO is nil, the translation from FROM | ||
| 2323 | to nothing is defined in the translation table and that element | ||
| 2324 | is ignored in the reverse map. If FROM is nil, the translation | ||
| 2325 | from TO to nothing is defined in the reverse map only. A vector | ||
| 2326 | of length zero has the same meaning as specifying nil." | ||
| 2253 | (let ((tables (vector (make-char-table 'translation-table) | 2327 | (let ((tables (vector (make-char-table 'translation-table) |
| 2254 | (make-char-table 'translation-table))) | 2328 | (make-char-table 'translation-table))) |
| 2255 | table max-lookup from to idx val) | 2329 | table max-lookup from to idx val) |
| @@ -2262,20 +2336,23 @@ The first extra-slot of the value is a translation table for reverse mapping." | |||
| 2262 | (setq from (cdr elt) to (car elt))) | 2336 | (setq from (cdr elt) to (car elt))) |
| 2263 | (if (characterp from) | 2337 | (if (characterp from) |
| 2264 | (setq idx from) | 2338 | (setq idx from) |
| 2265 | (setq idx (aref from 0) | 2339 | (if (= (length from) 0) |
| 2266 | max-lookup (max max-lookup (length from)))) | 2340 | (setq idx nil) |
| 2267 | (setq val (aref table idx)) | 2341 | (setq idx (aref from 0) |
| 2268 | (if val | 2342 | max-lookup (max max-lookup (length from))))) |
| 2269 | (progn | 2343 | (when idx |
| 2270 | (or (consp val) | 2344 | (setq val (aref table idx)) |
| 2271 | (setq val (list (cons (vector idx) val)))) | 2345 | (if val |
| 2272 | (if (characterp from) | 2346 | (progn |
| 2273 | (setq from (vector from))) | 2347 | (or (consp val) |
| 2274 | (setq val (nconc val (list (cons from to))))) | 2348 | (setq val (list (cons (vector idx) val)))) |
| 2275 | (if (characterp from) | 2349 | (if (characterp from) |
| 2276 | (setq val to) | 2350 | (setq from (vector from))) |
| 2277 | (setq val (list (cons from to))))) | 2351 | (setq val (nconc val (list (cons from to))))) |
| 2278 | (aset table idx val)) | 2352 | (if (characterp from) |
| 2353 | (setq val to) | ||
| 2354 | (setq val (list (cons from to))))) | ||
| 2355 | (aset table idx val))) | ||
| 2279 | (set-char-table-extra-slot table 1 max-lookup)) | 2356 | (set-char-table-extra-slot table 1 max-lookup)) |
| 2280 | (set-char-table-extra-slot (aref tables 0) 0 (aref tables 1)) | 2357 | (set-char-table-extra-slot (aref tables 0) 0 (aref tables 1)) |
| 2281 | (aref tables 0))) | 2358 | (aref tables 0))) |
diff --git a/lisp/language/misc-lang.el b/lisp/language/misc-lang.el index ee06e34eef4..b56d31f6e16 100644 --- a/lisp/language/misc-lang.el +++ b/lisp/language/misc-lang.el | |||
| @@ -78,7 +78,8 @@ and Italian."))) | |||
| 78 | (set-char-table-range | 78 | (set-char-table-range |
| 79 | composition-function-table | 79 | composition-function-table |
| 80 | '(#x600 . #x6FF) | 80 | '(#x600 . #x6FF) |
| 81 | (list ["[\u0600-\u06FF]+" 0 font-shape-gstring])) | 81 | (list ["\u200D?[\u0600-\u074F]+[\u200D\u200C]*[\u0600-\u074F]+\u200D?" |
| 82 | 0 font-shape-gstring])) | ||
| 82 | 83 | ||
| 83 | (provide 'misc-lang) | 84 | (provide 'misc-lang) |
| 84 | 85 | ||
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 8f33641a746..ea5794dfd0b 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -373,35 +373,29 @@ | |||
| 373 | 373 | ||
| 374 | (bindings--define-key menu [set-tags-name] | 374 | (bindings--define-key menu [set-tags-name] |
| 375 | '(menu-item "Set Tags File Name..." visit-tags-table | 375 | '(menu-item "Set Tags File Name..." visit-tags-table |
| 376 | :help "Tell Tags commands which tag table file to use")) | 376 | :visible (menu-bar-goto-uses-etags-p) |
| 377 | :help "Tell navigation commands which tag table file to use")) | ||
| 377 | 378 | ||
| 378 | (bindings--define-key menu [separator-tag-file] | 379 | (bindings--define-key menu [separator-tag-file] |
| 379 | menu-bar-separator) | 380 | '(menu-item "--" nil :visible (menu-bar-goto-uses-etags-p))) |
| 381 | |||
| 382 | (bindings--define-key menu [xref-pop] | ||
| 383 | '(menu-item "Back" xref-pop-marker-stack | ||
| 384 | :help "Back to the position of the last search")) | ||
| 380 | 385 | ||
| 381 | (bindings--define-key menu [apropos-tags] | 386 | (bindings--define-key menu [xref-apropos] |
| 382 | '(menu-item "Tags Apropos..." tags-apropos | 387 | '(menu-item "Find Apropos..." xref-find-apropos |
| 383 | :help "Find function/variables whose names match regexp")) | 388 | :help "Find function/variables whose names match regexp")) |
| 384 | (bindings--define-key menu [next-tag-otherw] | 389 | |
| 385 | '(menu-item "Next Tag in Other Window" | 390 | (bindings--define-key menu [xref-find-otherw] |
| 386 | menu-bar-next-tag-other-window | 391 | '(menu-item "Find Definition in Other Window..." |
| 387 | :enable (and (boundp 'tags-location-ring) | 392 | xref-find-definitions-other-window |
| 388 | (not (ring-empty-p tags-location-ring))) | ||
| 389 | :help "Find next function/variable matching last tag name in another window")) | ||
| 390 | |||
| 391 | (bindings--define-key menu [next-tag] | ||
| 392 | '(menu-item "Find Next Tag" | ||
| 393 | menu-bar-next-tag | ||
| 394 | :enable (and (boundp 'tags-location-ring) | ||
| 395 | (not (ring-empty-p tags-location-ring))) | ||
| 396 | :help "Find next function/variable matching last tag name")) | ||
| 397 | (bindings--define-key menu [find-tag-otherw] | ||
| 398 | '(menu-item "Find Tag in Other Window..." find-tag-other-window | ||
| 399 | :help "Find function/variable definition in another window")) | 393 | :help "Find function/variable definition in another window")) |
| 400 | (bindings--define-key menu [find-tag] | 394 | (bindings--define-key menu [xref-find-def] |
| 401 | '(menu-item "Find Tag..." find-tag | 395 | '(menu-item "Find Definition..." xref-find-definitions |
| 402 | :help "Find definition of function or variable")) | 396 | :help "Find definition of function or variable")) |
| 403 | 397 | ||
| 404 | (bindings--define-key menu [separator-tags] | 398 | (bindings--define-key menu [separator-xref] |
| 405 | menu-bar-separator) | 399 | menu-bar-separator) |
| 406 | 400 | ||
| 407 | (bindings--define-key menu [end-of-buf] | 401 | (bindings--define-key menu [end-of-buf] |
| @@ -416,6 +410,9 @@ | |||
| 416 | :help "Read a line number and go to that line")) | 410 | :help "Read a line number and go to that line")) |
| 417 | menu)) | 411 | menu)) |
| 418 | 412 | ||
| 413 | (defun menu-bar-goto-uses-etags-p () | ||
| 414 | (or (not (boundp 'xref-find-function)) | ||
| 415 | (eq xref-find-function 'etags-xref-find))) | ||
| 419 | 416 | ||
| 420 | (defvar yank-menu (cons (purecopy "Select Yank") nil)) | 417 | (defvar yank-menu (cons (purecopy "Select Yank") nil)) |
| 421 | (fset 'yank-menu (cons 'keymap yank-menu)) | 418 | (fset 'yank-menu (cons 'keymap yank-menu)) |
| @@ -514,16 +511,6 @@ | |||
| 514 | 511 | ||
| 515 | menu)) | 512 | menu)) |
| 516 | 513 | ||
| 517 | (defun menu-bar-next-tag-other-window () | ||
| 518 | "Find the next definition of the tag already specified." | ||
| 519 | (interactive) | ||
| 520 | (find-tag-other-window nil t)) | ||
| 521 | |||
| 522 | (defun menu-bar-next-tag () | ||
| 523 | "Find the next definition of the tag already specified." | ||
| 524 | (interactive) | ||
| 525 | (find-tag nil t)) | ||
| 526 | |||
| 527 | (define-obsolete-function-alias | 514 | (define-obsolete-function-alias |
| 528 | 'menu-bar-kill-ring-save 'kill-ring-save "24.1") | 515 | 'menu-bar-kill-ring-save 'kill-ring-save "24.1") |
| 529 | 516 | ||
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index e1e6b0ee907..91989016067 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -1818,8 +1818,9 @@ variables.") | |||
| 1818 | ,(if (eq (selected-window) (minibuffer-window)) | 1818 | ,(if (eq (selected-window) (minibuffer-window)) |
| 1819 | 'display-buffer-at-bottom | 1819 | 'display-buffer-at-bottom |
| 1820 | 'display-buffer-below-selected)) | 1820 | 'display-buffer-below-selected)) |
| 1821 | ,(when temp-buffer-resize-mode | 1821 | ,(if temp-buffer-resize-mode |
| 1822 | '(window-height . resize-temp-buffer-window)) | 1822 | '(window-height . resize-temp-buffer-window) |
| 1823 | '(window-height . shrink-window-if-larger-than-buffer)) | ||
| 1823 | ,(when temp-buffer-resize-mode | 1824 | ,(when temp-buffer-resize-mode |
| 1824 | '(preserve-size . (nil . t)))) | 1825 | '(preserve-size . (nil . t)))) |
| 1825 | nil | 1826 | nil |
diff --git a/lisp/net/eww.el b/lisp/net/eww.el index c6d3bbceda2..af902ded472 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el | |||
| @@ -445,7 +445,7 @@ See the `eww-search-prefix' variable for the search engine used." | |||
| 445 | ("start" . :start) | 445 | ("start" . :start) |
| 446 | ("home" . :home) | 446 | ("home" . :home) |
| 447 | ("contents" . :contents) | 447 | ("contents" . :contents) |
| 448 | ("up" . up))))) | 448 | ("up" . :up))))) |
| 449 | (and href | 449 | (and href |
| 450 | where | 450 | where |
| 451 | (plist-put eww-data (cdr where) href)))) | 451 | (plist-put eww-data (cdr where) href)))) |
| @@ -705,6 +705,9 @@ the like." | |||
| 705 | (setq-local tool-bar-map eww-tool-bar-map)) | 705 | (setq-local tool-bar-map eww-tool-bar-map)) |
| 706 | ;; desktop support | 706 | ;; desktop support |
| 707 | (setq-local desktop-save-buffer 'eww-desktop-misc-data) | 707 | (setq-local desktop-save-buffer 'eww-desktop-misc-data) |
| 708 | ;; multi-page isearch support | ||
| 709 | (setq-local multi-isearch-next-buffer-function 'eww-isearch-next-buffer) | ||
| 710 | (setq truncate-lines t) | ||
| 708 | (buffer-disable-undo) | 711 | (buffer-disable-undo) |
| 709 | (setq buffer-read-only t)) | 712 | (setq buffer-read-only t)) |
| 710 | 713 | ||
| @@ -1884,6 +1887,19 @@ Otherwise, the restored buffer will contain a prompt to do so by using | |||
| 1884 | (add-to-list 'desktop-buffer-mode-handlers | 1887 | (add-to-list 'desktop-buffer-mode-handlers |
| 1885 | '(eww-mode . eww-restore-desktop)) | 1888 | '(eww-mode . eww-restore-desktop)) |
| 1886 | 1889 | ||
| 1890 | ;;; Isearch support | ||
| 1891 | |||
| 1892 | (defun eww-isearch-next-buffer (&optional buffer wrap) | ||
| 1893 | "Go to the next page to search using `rel' attribute for navigation." | ||
| 1894 | (if wrap | ||
| 1895 | (condition-case nil | ||
| 1896 | (eww-top-url) | ||
| 1897 | (error nil)) | ||
| 1898 | (if isearch-forward | ||
| 1899 | (eww-next-url) | ||
| 1900 | (eww-previous-url))) | ||
| 1901 | (current-buffer)) | ||
| 1902 | |||
| 1887 | (provide 'eww) | 1903 | (provide 'eww) |
| 1888 | 1904 | ||
| 1889 | ;;; eww.el ends here | 1905 | ;;; eww.el ends here |
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 387bb024a52..6553fd3958c 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -78,11 +78,12 @@ If nil, don't draw horizontal table lines." | |||
| 78 | :group 'shr | 78 | :group 'shr |
| 79 | :type 'character) | 79 | :type 'character) |
| 80 | 80 | ||
| 81 | (defcustom shr-width fill-column | 81 | (defcustom shr-width nil |
| 82 | "Frame width to use for rendering. | 82 | "Frame width to use for rendering. |
| 83 | May either be an integer specifying a fixed width in characters, | 83 | May either be an integer specifying a fixed width in characters, |
| 84 | or nil, meaning that the full width of the window should be | 84 | or nil, meaning that the full width of the window should be |
| 85 | used." | 85 | used." |
| 86 | :version "25.1" | ||
| 86 | :type '(choice (integer :tag "Fixed width in characters") | 87 | :type '(choice (integer :tag "Fixed width in characters") |
| 87 | (const :tag "Use the width of the window" nil)) | 88 | (const :tag "Use the width of the window" nil)) |
| 88 | :group 'shr) | 89 | :group 'shr) |
| @@ -1439,10 +1440,11 @@ The preference is a float determined from `shr-prefer-media-type'." | |||
| 1439 | 1440 | ||
| 1440 | (defun shr-tag-table (dom) | 1441 | (defun shr-tag-table (dom) |
| 1441 | (shr-ensure-paragraph) | 1442 | (shr-ensure-paragraph) |
| 1442 | (let* ((caption (dom-child-by-tag dom 'caption)) | 1443 | (let* ((caption (dom-children (dom-child-by-tag dom 'caption))) |
| 1443 | (header (dom-child-by-tag dom 'thead)) | 1444 | (header (dom-non-text-children (dom-child-by-tag dom 'thead))) |
| 1444 | (body (or (dom-child-by-tag dom 'tbody) dom)) | 1445 | (body (dom-non-text-children (or (dom-child-by-tag dom 'tbody) |
| 1445 | (footer (dom-child-by-tag dom 'tfoot)) | 1446 | dom))) |
| 1447 | (footer (dom-non-text-children (dom-child-by-tag dom 'tfoot))) | ||
| 1446 | (bgcolor (dom-attr dom 'bgcolor)) | 1448 | (bgcolor (dom-attr dom 'bgcolor)) |
| 1447 | (start (point)) | 1449 | (start (point)) |
| 1448 | (shr-stylesheet (nconc (list (cons 'background-color bgcolor)) | 1450 | (shr-stylesheet (nconc (list (cons 'background-color bgcolor)) |
| @@ -1461,42 +1463,62 @@ The preference is a float determined from `shr-prefer-media-type'." | |||
| 1461 | ;; It's a real table, so render it. | 1463 | ;; It's a real table, so render it. |
| 1462 | (shr-tag-table-1 | 1464 | (shr-tag-table-1 |
| 1463 | (nconc | 1465 | (nconc |
| 1464 | (if caption `((tr (td ,@caption)))) | 1466 | (list 'table nil) |
| 1465 | (if header | 1467 | (if caption `((tr nil (td nil ,@caption)))) |
| 1466 | (if footer | 1468 | (cond (header |
| 1467 | ;; header + body + footer | 1469 | (if footer |
| 1468 | (if (= nheader nbody) | 1470 | ;; header + body + footer |
| 1469 | (if (= nbody nfooter) | 1471 | (if (= nheader nbody) |
| 1470 | `((tr (td (table (tbody ,@header ,@body ,@footer))))) | 1472 | (if (= nbody nfooter) |
| 1471 | (nconc `((tr (td (table (tbody ,@header ,@body))))) | 1473 | `((tr nil (td nil (table nil |
| 1472 | (if (= nfooter 1) | 1474 | (tbody nil ,@header |
| 1473 | footer | 1475 | ,@body ,@footer))))) |
| 1474 | `((tr (td (table (tbody ,@footer)))))))) | 1476 | (nconc `((tr nil (td nil (table nil |
| 1475 | (nconc `((tr (td (table (tbody ,@header))))) | 1477 | (tbody nil ,@header |
| 1476 | (if (= nbody nfooter) | 1478 | ,@body))))) |
| 1477 | `((tr (td (table (tbody ,@body ,@footer))))) | 1479 | (if (= nfooter 1) |
| 1478 | (nconc `((tr (td (table (tbody ,@body))))) | 1480 | footer |
| 1479 | (if (= nfooter 1) | 1481 | `((tr nil (td nil (table |
| 1480 | footer | 1482 | nil (tbody |
| 1481 | `((tr (td (table (tbody ,@footer)))))))))) | 1483 | nil ,@footer)))))))) |
| 1482 | ;; header + body | 1484 | (nconc `((tr nil (td nil (table nil (tbody |
| 1483 | (if (= nheader nbody) | 1485 | nil ,@header))))) |
| 1484 | `((tr (td (table (tbody ,@header ,@body))))) | 1486 | (if (= nbody nfooter) |
| 1485 | (if (= nheader 1) | 1487 | `((tr nil (td nil (table |
| 1486 | `(,@header (tr (td (table (tbody ,@body))))) | 1488 | nil (tbody nil ,@body |
| 1487 | `((tr (td (table (tbody ,@header)))) | 1489 | ,@footer))))) |
| 1488 | (tr (td (table (tbody ,@body)))))))) | 1490 | (nconc `((tr nil (td nil (table |
| 1489 | (if footer | 1491 | nil (tbody nil |
| 1490 | ;; body + footer | 1492 | ,@body))))) |
| 1491 | (if (= nbody nfooter) | 1493 | (if (= nfooter 1) |
| 1492 | `((tr (td (table (tbody ,@body ,@footer))))) | 1494 | footer |
| 1493 | (nconc `((tr (td (table (tbody ,@body))))) | 1495 | `((tr nil (td nil (table |
| 1494 | (if (= nfooter 1) | 1496 | nil |
| 1495 | footer | 1497 | (tbody |
| 1496 | `((tr (td (table (tbody ,@footer)))))))) | 1498 | nil |
| 1497 | (if caption | 1499 | ,@footer)))))))))) |
| 1498 | `((tr (td (table (tbody ,@body))))) | 1500 | ;; header + body |
| 1499 | body)))))) | 1501 | (if (= nheader nbody) |
| 1502 | `((tr nil (td nil (table nil (tbody nil ,@header | ||
| 1503 | ,@body))))) | ||
| 1504 | (if (= nheader 1) | ||
| 1505 | `(,@header (tr nil (td nil (table | ||
| 1506 | nil (tbody nil ,@body))))) | ||
| 1507 | `((tr nil (td nil (table nil (tbody nil ,@header)))) | ||
| 1508 | (tr nil (td nil (table nil (tbody nil ,@body))))))))) | ||
| 1509 | (footer | ||
| 1510 | ;; body + footer | ||
| 1511 | (if (= nbody nfooter) | ||
| 1512 | `((tr nil (td nil (table | ||
| 1513 | nil (tbody nil ,@body ,@footer))))) | ||
| 1514 | (nconc `((tr nil (td nil (table nil (tbody nil ,@body))))) | ||
| 1515 | (if (= nfooter 1) | ||
| 1516 | footer | ||
| 1517 | `((tr nil (td nil (table | ||
| 1518 | nil (tbody nil ,@footer))))))))) | ||
| 1519 | (caption | ||
| 1520 | `((tr nil (td nil (table nil (tbody nil ,@body)))))) | ||
| 1521 | (body))))) | ||
| 1500 | (when bgcolor | 1522 | (when bgcolor |
| 1501 | (shr-colorize-region start (point) (cdr (assq 'color shr-stylesheet)) | 1523 | (shr-colorize-region start (point) (cdr (assq 'color shr-stylesheet)) |
| 1502 | bgcolor)) | 1524 | bgcolor)) |
diff --git a/lisp/net/tramp-gw.el b/lisp/net/tramp-gw.el index 0decd8847cc..e21aaf78914 100644 --- a/lisp/net/tramp-gw.el +++ b/lisp/net/tramp-gw.el | |||
| @@ -195,11 +195,12 @@ instead of the host name declared in TARGET-VEC." | |||
| 195 | (setq tramp-gw-gw-proc | 195 | (setq tramp-gw-gw-proc |
| 196 | (funcall | 196 | (funcall |
| 197 | socks-function | 197 | socks-function |
| 198 | (tramp-get-connection-name gw-vec) | 198 | (let ((tramp-verbose 0)) (tramp-get-connection-name gw-vec)) |
| 199 | (tramp-get-connection-buffer gw-vec) | 199 | (let ((tramp-verbose 0)) (tramp-get-connection-buffer gw-vec)) |
| 200 | (tramp-file-name-real-host target-vec) | 200 | (tramp-file-name-real-host target-vec) |
| 201 | (tramp-file-name-port target-vec))) | 201 | (tramp-file-name-port target-vec))) |
| 202 | (set-process-sentinel tramp-gw-gw-proc 'tramp-gw-gw-proc-sentinel) | 202 | (set-process-sentinel tramp-gw-gw-proc 'tramp-gw-gw-proc-sentinel) |
| 203 | (set-process-coding-system tramp-gw-gw-proc 'binary 'binary) | ||
| 203 | (tramp-compat-set-process-query-on-exit-flag tramp-gw-gw-proc nil) | 204 | (tramp-compat-set-process-query-on-exit-flag tramp-gw-gw-proc nil) |
| 204 | (tramp-message | 205 | (tramp-message |
| 205 | vec 4 "Opened %s process `%s'" | 206 | vec 4 "Opened %s process `%s'" |
| @@ -260,6 +261,10 @@ authentication is requested from proxy server, provide it." | |||
| 260 | (200 (setq found t)) | 261 | (200 (setq found t)) |
| 261 | ;; We need basic authentication. | 262 | ;; We need basic authentication. |
| 262 | (401 (setq authentication (tramp-gw-basic-authentication nil first))) | 263 | (401 (setq authentication (tramp-gw-basic-authentication nil first))) |
| 264 | ;; Access forbidden. | ||
| 265 | (403 (tramp-error-with-buffer | ||
| 266 | (current-buffer) tramp-gw-vector 'file-error | ||
| 267 | "Connection to %s:%d forbidden." host service)) | ||
| 263 | ;; Target host not found. | 268 | ;; Target host not found. |
| 264 | (404 (tramp-error-with-buffer | 269 | (404 (tramp-error-with-buffer |
| 265 | (current-buffer) tramp-gw-vector 'file-error | 270 | (current-buffer) tramp-gw-vector 'file-error |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index ba7b7d95a4b..6fc2effbe0f 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -2471,8 +2471,12 @@ The method used must be an out-of-band method." | |||
| 2471 | (mapconcat 'identity (process-command p) " ")) | 2471 | (mapconcat 'identity (process-command p) " ")) |
| 2472 | (tramp-set-connection-property p "vector" orig-vec) | 2472 | (tramp-set-connection-property p "vector" orig-vec) |
| 2473 | (tramp-compat-set-process-query-on-exit-flag p nil) | 2473 | (tramp-compat-set-process-query-on-exit-flag p nil) |
| 2474 | (tramp-process-actions | 2474 | |
| 2475 | p v nil tramp-actions-copy-out-of-band) | 2475 | ;; We must adapt `tramp-local-end-of-line' for |
| 2476 | ;; sending the password. | ||
| 2477 | (let ((tramp-local-end-of-line tramp-rsh-end-of-line)) | ||
| 2478 | (tramp-process-actions | ||
| 2479 | p v nil tramp-actions-copy-out-of-band)) | ||
| 2476 | 2480 | ||
| 2477 | ;; Check the return code. | 2481 | ;; Check the return code. |
| 2478 | (goto-char (point-max)) | 2482 | (goto-char (point-max)) |
| @@ -2883,7 +2887,7 @@ the result will be a local, non-Tramp, file name." | |||
| 2883 | (name1 name) | 2887 | (name1 name) |
| 2884 | (i 0) | 2888 | (i 0) |
| 2885 | ;; We do not want to raise an error when | 2889 | ;; We do not want to raise an error when |
| 2886 | ;; `start-file-process' has been started several time in | 2890 | ;; `start-file-process' has been started several times in |
| 2887 | ;; `eshell' and friends. | 2891 | ;; `eshell' and friends. |
| 2888 | (tramp-current-connection nil)) | 2892 | (tramp-current-connection nil)) |
| 2889 | 2893 | ||
| @@ -4510,7 +4514,8 @@ Gateway hops are already opened." | |||
| 4510 | ;; Therefore, we must remember the gateway vector. But we | 4514 | ;; Therefore, we must remember the gateway vector. But we |
| 4511 | ;; cannot do it as connection property, because it shouldn't | 4515 | ;; cannot do it as connection property, because it shouldn't |
| 4512 | ;; be persistent. And we have no started process yet either. | 4516 | ;; be persistent. And we have no started process yet either. |
| 4513 | (tramp-set-file-property (car target-alist) "" "gateway" hop))) | 4517 | (let ((tramp-verbose 0)) |
| 4518 | (tramp-set-file-property (car target-alist) "" "gateway" hop)))) | ||
| 4514 | 4519 | ||
| 4515 | ;; Foreign and out-of-band methods are not supported for multi-hops. | 4520 | ;; Foreign and out-of-band methods are not supported for multi-hops. |
| 4516 | (when (cdr target-alist) | 4521 | (when (cdr target-alist) |
| @@ -4687,7 +4692,8 @@ connection if a previous connection has died for some reason." | |||
| 4687 | l-method 'tramp-connection-timeout)) | 4692 | l-method 'tramp-connection-timeout)) |
| 4688 | (gw-args | 4693 | (gw-args |
| 4689 | (tramp-get-method-parameter l-method 'tramp-gw-args)) | 4694 | (tramp-get-method-parameter l-method 'tramp-gw-args)) |
| 4690 | (gw (tramp-get-file-property hop "" "gateway" nil)) | 4695 | (gw (let ((tramp-verbose 0)) |
| 4696 | (tramp-get-file-property hop "" "gateway" nil))) | ||
| 4691 | (g-method (and gw (tramp-file-name-method gw))) | 4697 | (g-method (and gw (tramp-file-name-method gw))) |
| 4692 | (g-user (and gw (tramp-file-name-user gw))) | 4698 | (g-user (and gw (tramp-file-name-user gw))) |
| 4693 | (g-host (and gw (tramp-file-name-real-host gw))) | 4699 | (g-host (and gw (tramp-file-name-real-host gw))) |
| @@ -4715,8 +4721,10 @@ connection if a previous connection has died for some reason." | |||
| 4715 | (setq login-args (append async-args login-args))) | 4721 | (setq login-args (append async-args login-args))) |
| 4716 | 4722 | ||
| 4717 | ;; Add gateway arguments if necessary. | 4723 | ;; Add gateway arguments if necessary. |
| 4718 | (when (and gw gw-args) | 4724 | (when gw |
| 4719 | (setq login-args (append gw-args login-args))) | 4725 | (tramp-set-connection-property p "gateway" t) |
| 4726 | (when gw-args | ||
| 4727 | (setq login-args (append gw-args login-args)))) | ||
| 4720 | 4728 | ||
| 4721 | ;; Check for port number. Until now, there's no | 4729 | ;; Check for port number. Until now, there's no |
| 4722 | ;; need for handling like method, user, host. | 4730 | ;; need for handling like method, user, host. |
| @@ -4902,8 +4910,9 @@ FMT and ARGS which are passed to `error'." | |||
| 4902 | (or (tramp-send-command-and-check vec command) | 4910 | (or (tramp-send-command-and-check vec command) |
| 4903 | (apply 'tramp-error vec 'file-error fmt args))) | 4911 | (apply 'tramp-error vec 'file-error fmt args))) |
| 4904 | 4912 | ||
| 4905 | (defun tramp-send-command-and-read (vec command &optional noerror) | 4913 | (defun tramp-send-command-and-read (vec command &optional noerror marker) |
| 4906 | "Run COMMAND and return the output, which must be a Lisp expression. | 4914 | "Run COMMAND and return the output, which must be a Lisp expression. |
| 4915 | If MARKER is a regexp, read the output after that string. | ||
| 4907 | In case there is no valid Lisp expression and NOERROR is nil, it | 4916 | In case there is no valid Lisp expression and NOERROR is nil, it |
| 4908 | raises an error." | 4917 | raises an error." |
| 4909 | (when (if noerror | 4918 | (when (if noerror |
| @@ -4911,8 +4920,17 @@ raises an error." | |||
| 4911 | (tramp-barf-unless-okay | 4920 | (tramp-barf-unless-okay |
| 4912 | vec command "`%s' returns with error" command)) | 4921 | vec command "`%s' returns with error" command)) |
| 4913 | (with-current-buffer (tramp-get-connection-buffer vec) | 4922 | (with-current-buffer (tramp-get-connection-buffer vec) |
| 4914 | ;; Read the expression. | ||
| 4915 | (goto-char (point-min)) | 4923 | (goto-char (point-min)) |
| 4924 | ;; Read the marker. | ||
| 4925 | (when (stringp marker) | ||
| 4926 | (condition-case nil | ||
| 4927 | (re-search-forward marker) | ||
| 4928 | (error (unless noerror | ||
| 4929 | (tramp-error | ||
| 4930 | vec 'file-error | ||
| 4931 | "`%s' does not return the marker `%s': `%s'" | ||
| 4932 | command marker (buffer-string)))))) | ||
| 4933 | ;; Read the expression. | ||
| 4916 | (condition-case nil | 4934 | (condition-case nil |
| 4917 | (prog1 (read (current-buffer)) | 4935 | (prog1 (read (current-buffer)) |
| 4918 | ;; Error handling. | 4936 | ;; Error handling. |
| @@ -5064,25 +5082,22 @@ Return ATTR." | |||
| 5064 | "/bin:/usr/bin") | 5082 | "/bin:/usr/bin") |
| 5065 | "/bin:/usr/bin")))) | 5083 | "/bin:/usr/bin")))) |
| 5066 | (own-remote-path | 5084 | (own-remote-path |
| 5067 | ;; We cannot apply `tramp-send-command-and-read' because | 5085 | ;; The login shell could return more than just the $PATH |
| 5068 | ;; the login shell could return more than just the $PATH | 5086 | ;; string. So we use `tramp-end-of-heredoc' as marker. |
| 5069 | ;; string. So we emulate that function. | ||
| 5070 | (when elt2 | 5087 | (when elt2 |
| 5071 | (tramp-send-command | 5088 | (tramp-send-command-and-read |
| 5072 | vec | 5089 | vec |
| 5073 | (format | 5090 | (format |
| 5074 | "%s -l %s 'echo \\\"$PATH\\\"'" | 5091 | "%s -l %s 'echo %s \\\"$PATH\\\"'" |
| 5075 | (tramp-get-method-parameter | 5092 | (tramp-get-method-parameter |
| 5076 | (tramp-file-name-method vec) 'tramp-remote-shell) | 5093 | (tramp-file-name-method vec) 'tramp-remote-shell) |
| 5077 | (mapconcat | 5094 | (mapconcat |
| 5078 | 'identity | 5095 | 'identity |
| 5079 | (tramp-get-method-parameter | 5096 | (tramp-get-method-parameter |
| 5080 | (tramp-file-name-method vec) 'tramp-remote-shell-args) | 5097 | (tramp-file-name-method vec) 'tramp-remote-shell-args) |
| 5081 | " "))) | 5098 | " ") |
| 5082 | (with-current-buffer (tramp-get-connection-buffer vec) | 5099 | (tramp-shell-quote-argument tramp-end-of-heredoc)) |
| 5083 | (goto-char (point-max)) | 5100 | nil (regexp-quote tramp-end-of-heredoc))))) |
| 5084 | (forward-line -1) | ||
| 5085 | (read (current-buffer)))))) | ||
| 5086 | 5101 | ||
| 5087 | ;; Replace place holder `tramp-default-remote-path'. | 5102 | ;; Replace place holder `tramp-default-remote-path'. |
| 5088 | (when elt1 | 5103 | (when elt1 |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 2cf9d45b965..3c8b5bbd60e 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1610,7 +1610,7 @@ an input event arrives. The other arguments are passed to `tramp-error'." | |||
| 1610 | (let ((enable-recursive-minibuffers t)) | 1610 | (let ((enable-recursive-minibuffers t)) |
| 1611 | ;; `tramp-error' does not show messages. So we must do it | 1611 | ;; `tramp-error' does not show messages. So we must do it |
| 1612 | ;; ourselves. | 1612 | ;; ourselves. |
| 1613 | (message fmt-string arguments) | 1613 | (apply 'message fmt-string arguments) |
| 1614 | ;; Show buffer. | 1614 | ;; Show buffer. |
| 1615 | (pop-to-buffer buf) | 1615 | (pop-to-buffer buf) |
| 1616 | (discard-input) | 1616 | (discard-input) |
| @@ -3086,115 +3086,118 @@ User is always nil." | |||
| 3086 | (setq filename (expand-file-name filename)) | 3086 | (setq filename (expand-file-name filename)) |
| 3087 | (let (result local-copy remote-copy) | 3087 | (let (result local-copy remote-copy) |
| 3088 | (with-parsed-tramp-file-name filename nil | 3088 | (with-parsed-tramp-file-name filename nil |
| 3089 | (with-tramp-progress-reporter | 3089 | (unwind-protect |
| 3090 | v 3 (format "Inserting `%s'" filename) | 3090 | (if (not (file-exists-p filename)) |
| 3091 | (unwind-protect | 3091 | (tramp-error |
| 3092 | (if (not (file-exists-p filename)) | 3092 | v 'file-error "File `%s' not found on remote host" filename) |
| 3093 | (progn | 3093 | |
| 3094 | ;; We don't raise a Tramp error, because it might be | 3094 | (with-tramp-progress-reporter |
| 3095 | ;; suppressed, like in `find-file-noselect-1'. | 3095 | v 3 (format "Inserting `%s'" filename) |
| 3096 | (tramp-message | 3096 | (condition-case err |
| 3097 | v 1 "File not `%s' found on remote host" filename) | 3097 | (if (and (tramp-local-host-p v) |
| 3098 | (signal 'file-error | 3098 | (let (file-name-handler-alist) |
| 3099 | (list "File not found on remote host" filename))) | 3099 | (file-readable-p localname))) |
| 3100 | 3100 | ;; Short track: if we are on the local host, we can | |
| 3101 | (if (and (tramp-local-host-p v) | 3101 | ;; run directly. |
| 3102 | (let (file-name-handler-alist) | 3102 | (setq result |
| 3103 | (file-readable-p localname))) | 3103 | (tramp-run-real-handler |
| 3104 | ;; Short track: if we are on the local host, we can | 3104 | 'insert-file-contents |
| 3105 | ;; run directly. | 3105 | (list localname visit beg end replace))) |
| 3106 | (setq result | 3106 | |
| 3107 | (tramp-run-real-handler | 3107 | ;; When we shall insert only a part of the file, we |
| 3108 | 'insert-file-contents | 3108 | ;; copy this part. This works only for the shell file |
| 3109 | (list localname visit beg end replace))) | 3109 | ;; name handlers. |
| 3110 | 3110 | (when (and (or beg end) | |
| 3111 | ;; When we shall insert only a part of the file, we | 3111 | (tramp-get-method-parameter |
| 3112 | ;; copy this part. This works only for the shell file | 3112 | (tramp-file-name-method v) |
| 3113 | ;; name handlers. | 3113 | 'tramp-login-program)) |
| 3114 | (when (and (or beg end) | 3114 | (setq remote-copy (tramp-make-tramp-temp-file v)) |
| 3115 | (tramp-get-method-parameter | 3115 | ;; This is defined in tramp-sh.el. Let's assume |
| 3116 | (tramp-file-name-method v) 'tramp-login-program)) | 3116 | ;; this is loaded already. |
| 3117 | (setq remote-copy (tramp-make-tramp-temp-file v)) | 3117 | (tramp-compat-funcall |
| 3118 | ;; This is defined in tramp-sh.el. Let's assume | 3118 | 'tramp-send-command |
| 3119 | ;; this is loaded already. | 3119 | v |
| 3120 | (tramp-compat-funcall | 3120 | (cond |
| 3121 | 'tramp-send-command | 3121 | ((and beg end) |
| 3122 | v | 3122 | (format "dd bs=1 skip=%d if=%s count=%d of=%s" |
| 3123 | (cond | 3123 | beg (tramp-shell-quote-argument localname) |
| 3124 | ((and beg end) | 3124 | (- end beg) remote-copy)) |
| 3125 | (format "dd bs=1 skip=%d if=%s count=%d of=%s" | 3125 | (beg |
| 3126 | beg (tramp-shell-quote-argument localname) | 3126 | (format "dd bs=1 skip=%d if=%s of=%s" |
| 3127 | (- end beg) remote-copy)) | 3127 | beg (tramp-shell-quote-argument localname) |
| 3128 | (beg | 3128 | remote-copy)) |
| 3129 | (format "dd bs=1 skip=%d if=%s of=%s" | 3129 | (end |
| 3130 | beg (tramp-shell-quote-argument localname) | 3130 | (format "dd bs=1 count=%d if=%s of=%s" |
| 3131 | remote-copy)) | 3131 | end (tramp-shell-quote-argument localname) |
| 3132 | (end | 3132 | remote-copy)))) |
| 3133 | (format "dd bs=1 count=%d if=%s of=%s" | 3133 | (setq tramp-temp-buffer-file-name nil beg nil end nil)) |
| 3134 | end (tramp-shell-quote-argument localname) | 3134 | |
| 3135 | remote-copy)))) | 3135 | ;; `insert-file-contents-literally' takes care to |
| 3136 | (setq tramp-temp-buffer-file-name nil beg nil end nil)) | 3136 | ;; avoid calling jka-compr. By let-binding |
| 3137 | 3137 | ;; `inhibit-file-name-operation', we propagate that | |
| 3138 | ;; `insert-file-contents-literally' takes care to | 3138 | ;; care to the `file-local-copy' operation. |
| 3139 | ;; avoid calling jka-compr. By let-binding | 3139 | (setq local-copy |
| 3140 | ;; `inhibit-file-name-operation', we propagate that | 3140 | (let ((inhibit-file-name-operation |
| 3141 | ;; care to the `file-local-copy' operation. | 3141 | (when (eq inhibit-file-name-operation |
| 3142 | (setq local-copy | 3142 | 'insert-file-contents) |
| 3143 | (let ((inhibit-file-name-operation | 3143 | 'file-local-copy))) |
| 3144 | (when (eq inhibit-file-name-operation | 3144 | (cond |
| 3145 | 'insert-file-contents) | 3145 | ((stringp remote-copy) |
| 3146 | 'file-local-copy))) | 3146 | (file-local-copy |
| 3147 | (cond | 3147 | (tramp-make-tramp-file-name |
| 3148 | ((stringp remote-copy) | 3148 | method user host remote-copy))) |
| 3149 | (file-local-copy | 3149 | ((stringp tramp-temp-buffer-file-name) |
| 3150 | (tramp-make-tramp-file-name | 3150 | (copy-file |
| 3151 | method user host remote-copy))) | 3151 | filename tramp-temp-buffer-file-name 'ok) |
| 3152 | ((stringp tramp-temp-buffer-file-name) | 3152 | tramp-temp-buffer-file-name) |
| 3153 | (copy-file filename tramp-temp-buffer-file-name 'ok) | 3153 | (t (file-local-copy filename))))) |
| 3154 | tramp-temp-buffer-file-name) | 3154 | |
| 3155 | (t (file-local-copy filename))))) | 3155 | ;; When the file is not readable for the owner, it |
| 3156 | 3156 | ;; cannot be inserted, even if it is readable for the | |
| 3157 | ;; When the file is not readable for the owner, it | 3157 | ;; group or for everybody. |
| 3158 | ;; cannot be inserted, even if it is readable for the | 3158 | (set-file-modes |
| 3159 | ;; group or for everybody. | 3159 | local-copy (tramp-compat-octal-to-decimal "0600")) |
| 3160 | (set-file-modes | 3160 | |
| 3161 | local-copy (tramp-compat-octal-to-decimal "0600")) | 3161 | (when (and (null remote-copy) |
| 3162 | 3162 | (tramp-get-method-parameter | |
| 3163 | (when (and (null remote-copy) | 3163 | method 'tramp-copy-keep-tmpfile)) |
| 3164 | (tramp-get-method-parameter | 3164 | ;; We keep the local file for performance reasons, |
| 3165 | method 'tramp-copy-keep-tmpfile)) | 3165 | ;; useful for "rsync". |
| 3166 | ;; We keep the local file for performance reasons, | 3166 | (setq tramp-temp-buffer-file-name local-copy)) |
| 3167 | ;; useful for "rsync". | 3167 | |
| 3168 | (setq tramp-temp-buffer-file-name local-copy)) | 3168 | ;; We must ensure that `file-coding-system-alist' |
| 3169 | 3169 | ;; matches `local-copy'. We must also use `visit', | |
| 3170 | ;; We must ensure that `file-coding-system-alist' | 3170 | ;; otherwise there might be an error in the |
| 3171 | ;; matches `local-copy'. We must also use `visit', | 3171 | ;; `revert-buffer' function under XEmacs. |
| 3172 | ;; otherwise there might be an error in the | 3172 | (let ((file-coding-system-alist |
| 3173 | ;; `revert-buffer' function under XEmacs. | 3173 | (tramp-find-file-name-coding-system-alist |
| 3174 | (let ((file-coding-system-alist | 3174 | filename local-copy))) |
| 3175 | (tramp-find-file-name-coding-system-alist | 3175 | (setq result |
| 3176 | filename local-copy))) | 3176 | (insert-file-contents |
| 3177 | (setq result | 3177 | local-copy visit beg end replace)))) |
| 3178 | (insert-file-contents | 3178 | (error |
| 3179 | local-copy visit beg end replace))))) | 3179 | (add-hook 'find-file-not-found-functions |
| 3180 | 3180 | `(lambda () (signal ',(car err) ',(cdr err))) | |
| 3181 | ;; Save exit. | 3181 | nil t) |
| 3182 | (progn | 3182 | (signal (car err) (cdr err)))))) |
| 3183 | (when visit | 3183 | |
| 3184 | (setq buffer-file-name filename) | 3184 | ;; Save exit. |
| 3185 | (setq buffer-read-only (not (file-writable-p filename))) | 3185 | (progn |
| 3186 | (set-visited-file-modtime) | 3186 | (when visit |
| 3187 | (set-buffer-modified-p nil)) | 3187 | (setq buffer-file-name filename) |
| 3188 | (when (and (stringp local-copy) | 3188 | (setq buffer-read-only (not (file-writable-p filename))) |
| 3189 | (or remote-copy (null tramp-temp-buffer-file-name))) | 3189 | (set-visited-file-modtime) |
| 3190 | (delete-file local-copy)) | 3190 | (set-buffer-modified-p nil)) |
| 3191 | (when (stringp remote-copy) | 3191 | (when (and (stringp local-copy) |
| 3192 | (delete-file | 3192 | (or remote-copy (null tramp-temp-buffer-file-name))) |
| 3193 | (tramp-make-tramp-file-name method user host remote-copy))))))) | 3193 | (delete-file local-copy)) |
| 3194 | 3194 | (when (stringp remote-copy) | |
| 3195 | ;; Result. | 3195 | (delete-file |
| 3196 | (list (expand-file-name filename) | 3196 | (tramp-make-tramp-file-name method user host remote-copy))))) |
| 3197 | (cadr result)))) | 3197 | |
| 3198 | ;; Result. | ||
| 3199 | (list (expand-file-name filename) | ||
| 3200 | (cadr result))))) | ||
| 3198 | 3201 | ||
| 3199 | (defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix) | 3202 | (defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix) |
| 3200 | "Like `load' for Tramp files." | 3203 | "Like `load' for Tramp files." |
| @@ -3609,15 +3612,19 @@ connection buffer." | |||
| 3609 | This is needed in order to hide `last-coding-system-used', which is set | 3612 | This is needed in order to hide `last-coding-system-used', which is set |
| 3610 | for process communication also." | 3613 | for process communication also." |
| 3611 | (with-current-buffer (process-buffer proc) | 3614 | (with-current-buffer (process-buffer proc) |
| 3612 | (tramp-message proc 10 "%s %s" proc (process-status proc)) | 3615 | ;; FIXME: If there is a gateway process, we need communication |
| 3613 | (let (buffer-read-only last-coding-system-used) | 3616 | ;; between several processes. Too complicate to implement, so we |
| 3617 | ;; read output from all processes. | ||
| 3618 | (let ((p (if (tramp-get-connection-property proc "gateway" nil) nil proc)) | ||
| 3619 | buffer-read-only last-coding-system-used) | ||
| 3614 | ;; Under Windows XP, accept-process-output doesn't return | 3620 | ;; Under Windows XP, accept-process-output doesn't return |
| 3615 | ;; sometimes. So we add an additional timeout. | 3621 | ;; sometimes. So we add an additional timeout. |
| 3616 | (with-timeout ((or timeout 1)) | 3622 | (with-timeout ((or timeout 1)) |
| 3617 | (if (featurep 'xemacs) | 3623 | (if (featurep 'xemacs) |
| 3618 | (accept-process-output proc timeout timeout-msecs) | 3624 | (accept-process-output p timeout timeout-msecs) |
| 3619 | (accept-process-output proc timeout timeout-msecs (and proc t))))) | 3625 | (accept-process-output p timeout timeout-msecs (and proc t)))) |
| 3620 | (tramp-message proc 10 "\n%s" (buffer-string)))) | 3626 | (tramp-message proc 10 "%s %s %s\n%s" |
| 3627 | proc (process-status proc) p (buffer-string))))) | ||
| 3621 | 3628 | ||
| 3622 | (defun tramp-check-for-regexp (proc regexp) | 3629 | (defun tramp-check-for-regexp (proc regexp) |
| 3623 | "Check, whether REGEXP is contained in process buffer of PROC. | 3630 | "Check, whether REGEXP is contained in process buffer of PROC. |
| @@ -4184,25 +4191,27 @@ Invokes `password-read' if available, `read-passwd' else." | |||
| 4184 | ;; it's bound. `auth-source-user-or-password' is an | 4191 | ;; it's bound. `auth-source-user-or-password' is an |
| 4185 | ;; obsoleted function, it has been replaced by | 4192 | ;; obsoleted function, it has been replaced by |
| 4186 | ;; `auth-source-search'. | 4193 | ;; `auth-source-search'. |
| 4187 | (and (boundp 'auth-sources) | 4194 | (ignore-errors |
| 4188 | (tramp-get-connection-property | 4195 | (and (boundp 'auth-sources) |
| 4189 | v "first-password-request" nil) | 4196 | (tramp-get-connection-property |
| 4190 | ;; Try with Tramp's current method. | 4197 | v "first-password-request" nil) |
| 4191 | (if (fboundp 'auth-source-search) | 4198 | ;; Try with Tramp's current method. |
| 4192 | (setq auth-info | 4199 | (if (fboundp 'auth-source-search) |
| 4193 | (tramp-compat-funcall | 4200 | (setq auth-info |
| 4194 | 'auth-source-search | 4201 | (tramp-compat-funcall |
| 4195 | :max 1 | 4202 | 'auth-source-search |
| 4196 | :user (or tramp-current-user t) | 4203 | :max 1 |
| 4197 | :host tramp-current-host | 4204 | :user (or tramp-current-user t) |
| 4198 | :port tramp-current-method) | 4205 | :host tramp-current-host |
| 4199 | auth-passwd (plist-get (nth 0 auth-info) :secret) | 4206 | :port tramp-current-method) |
| 4200 | auth-passwd (if (functionp auth-passwd) | 4207 | auth-passwd (plist-get |
| 4201 | (funcall auth-passwd) | 4208 | (nth 0 auth-info) :secret) |
| 4202 | auth-passwd)) | 4209 | auth-passwd (if (functionp auth-passwd) |
| 4203 | (tramp-compat-funcall | 4210 | (funcall auth-passwd) |
| 4204 | 'auth-source-user-or-password | 4211 | auth-passwd)) |
| 4205 | "password" tramp-current-host tramp-current-method))) | 4212 | (tramp-compat-funcall |
| 4213 | 'auth-source-user-or-password | ||
| 4214 | "password" tramp-current-host tramp-current-method)))) | ||
| 4206 | ;; Try the password cache. | 4215 | ;; Try the password cache. |
| 4207 | (when (functionp 'password-read) | 4216 | (when (functionp 'password-read) |
| 4208 | (let ((password | 4217 | (let ((password |
diff --git a/lisp/nxml/rng-uri.el b/lisp/nxml/rng-uri.el index b93624a4f22..43218ec7c88 100644 --- a/lisp/nxml/rng-uri.el +++ b/lisp/nxml/rng-uri.el | |||
| @@ -85,7 +85,7 @@ Signal an error if URI is not a valid file URL." | |||
| 85 | ((not (string= (downcase scheme) "file")) | 85 | ((not (string= (downcase scheme) "file")) |
| 86 | (rng-uri-error "URI `%s' does not use the `file:' scheme" uri))) | 86 | (rng-uri-error "URI `%s' does not use the `file:' scheme" uri))) |
| 87 | (when (not (member authority | 87 | (when (not (member authority |
| 88 | (cons system-name '(nil "" "localhost")))) | 88 | (cons (system-name) '(nil "" "localhost")))) |
| 89 | (rng-uri-error "URI `%s' does not start with `file:///' or `file://localhost/'" | 89 | (rng-uri-error "URI `%s' does not start with `file:///' or `file://localhost/'" |
| 90 | uri)) | 90 | uri)) |
| 91 | (when query | 91 | (when query |
diff --git a/lisp/obsolete/pc-select.el b/lisp/obsolete/pc-select.el index 5ee0818a1e5..5404f490b88 100644 --- a/lisp/obsolete/pc-select.el +++ b/lisp/obsolete/pc-select.el | |||
| @@ -337,7 +337,7 @@ but before calling PC Selection mode): | |||
| 337 | (cadr pc-select-meta-moves-sexps-key-bindings)) | 337 | (cadr pc-select-meta-moves-sexps-key-bindings)) |
| 338 | (if (or pc-select-selection-keys-only | 338 | (if (or pc-select-selection-keys-only |
| 339 | (eq window-system 'x) | 339 | (eq window-system 'x) |
| 340 | (memq system-name '(ms-dos windows-nt))) | 340 | (memq system-type '(ms-dos windows-nt))) |
| 341 | nil | 341 | nil |
| 342 | pc-select-tty-key-bindings))) | 342 | pc-select-tty-key-bindings))) |
| 343 | 343 | ||
| @@ -346,7 +346,7 @@ but before calling PC Selection mode): | |||
| 346 | 346 | ||
| 347 | (unless (or pc-select-selection-keys-only | 347 | (unless (or pc-select-selection-keys-only |
| 348 | (eq window-system 'x) | 348 | (eq window-system 'x) |
| 349 | (memq system-name '(ms-dos windows-nt))) | 349 | (memq system-type '(ms-dos windows-nt))) |
| 350 | ;; it is not clear that we need the following line | 350 | ;; it is not clear that we need the following line |
| 351 | ;; I hope it doesn't do too much harm to leave it in, though... | 351 | ;; I hope it doesn't do too much harm to leave it in, though... |
| 352 | (setq pc-select-old-M-delete-binding | 352 | (setq pc-select-old-M-delete-binding |
| @@ -355,7 +355,7 @@ but before calling PC Selection mode): | |||
| 355 | 355 | ||
| 356 | (when (and (not pc-select-selection-keys-only) | 356 | (when (and (not pc-select-selection-keys-only) |
| 357 | (or (eq window-system 'x) | 357 | (or (eq window-system 'x) |
| 358 | (memq system-name '(ms-dos windows-nt))) | 358 | (memq system-type '(ms-dos windows-nt))) |
| 359 | (fboundp 'normal-erase-is-backspace-mode)) | 359 | (fboundp 'normal-erase-is-backspace-mode)) |
| 360 | (pc-select-save-and-set-mode normal-erase-is-backspace-mode 1 | 360 | (pc-select-save-and-set-mode normal-erase-is-backspace-mode 1 |
| 361 | normal-erase-is-backspace)) | 361 | normal-erase-is-backspace)) |
| @@ -378,13 +378,13 @@ but before calling PC Selection mode): | |||
| 378 | (current-global-map)) | 378 | (current-global-map)) |
| 379 | (unless (or pc-select-selection-keys-only | 379 | (unless (or pc-select-selection-keys-only |
| 380 | (eq window-system 'x) | 380 | (eq window-system 'x) |
| 381 | (memq system-name '(ms-dos windows-nt))) | 381 | (memq system-type '(ms-dos windows-nt))) |
| 382 | ;; it is not clear that we need the following line | 382 | ;; it is not clear that we need the following line |
| 383 | ;; I hope it doesn't do too much harm to leave it in, though... | 383 | ;; I hope it doesn't do too much harm to leave it in, though... |
| 384 | (define-key function-key-map [M-delete] [?\M-d])) | 384 | (define-key function-key-map [M-delete] [?\M-d])) |
| 385 | (when (and (not pc-select-selection-keys-only) | 385 | (when (and (not pc-select-selection-keys-only) |
| 386 | (or (eq window-system 'x) | 386 | (or (eq window-system 'x) |
| 387 | (memq system-name '(ms-dos windows-nt))) | 387 | (memq system-type '(ms-dos windows-nt))) |
| 388 | (fboundp 'normal-erase-is-backspace-mode)) | 388 | (fboundp 'normal-erase-is-backspace-mode)) |
| 389 | (normal-erase-is-backspace-mode 1)) | 389 | (normal-erase-is-backspace-mode 1)) |
| 390 | (setq highlight-nonselected-windows nil) | 390 | (setq highlight-nonselected-windows nil) |
| @@ -395,7 +395,7 @@ but before calling PC Selection mode): | |||
| 395 | (when pc-select-key-bindings-alist | 395 | (when pc-select-key-bindings-alist |
| 396 | (when (and (not pc-select-selection-keys-only) | 396 | (when (and (not pc-select-selection-keys-only) |
| 397 | (or (eq window-system 'x) | 397 | (or (eq window-system 'x) |
| 398 | (memq system-name '(ms-dos windows-nt)))) | 398 | (memq system-type '(ms-dos windows-nt)))) |
| 399 | (pc-select-restore-mode normal-erase-is-backspace-mode)) | 399 | (pc-select-restore-mode normal-erase-is-backspace-mode)) |
| 400 | 400 | ||
| 401 | (pc-select-restore-keys | 401 | (pc-select-restore-keys |
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 51c87892a9c..c9287586e4e 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el | |||
| @@ -2811,8 +2811,8 @@ The details of what will be saved are regulated by the variable | |||
| 2811 | (delete-region (point-min) (point-max)) | 2811 | (delete-region (point-min) (point-max)) |
| 2812 | ;;Store clock | 2812 | ;;Store clock |
| 2813 | (insert (format ";; org-persist.el - %s at %s\n" | 2813 | (insert (format ";; org-persist.el - %s at %s\n" |
| 2814 | system-name (format-time-string | 2814 | (system-name) (format-time-string |
| 2815 | (cdr org-time-stamp-formats)))) | 2815 | (cdr org-time-stamp-formats)))) |
| 2816 | (if (and (memq org-clock-persist '(t clock)) | 2816 | (if (and (memq org-clock-persist '(t clock)) |
| 2817 | (setq b (org-clocking-buffer)) | 2817 | (setq b (org-clocking-buffer)) |
| 2818 | (setq b (or (buffer-base-buffer b) b)) | 2818 | (setq b (or (buffer-base-buffer b) b)) |
diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el index 41775bdab6d..faf543be1b5 100644 --- a/lisp/org/org-ctags.el +++ b/lisp/org/org-ctags.el | |||
| @@ -63,19 +63,19 @@ | |||
| 63 | ;; with the same name as the link; then, if unsuccessful, ask the user if | 63 | ;; with the same name as the link; then, if unsuccessful, ask the user if |
| 64 | ;; he/she wants to rebuild the 'TAGS' database and try again; then ask if | 64 | ;; he/she wants to rebuild the 'TAGS' database and try again; then ask if |
| 65 | ;; the user wishes to append 'tag' as a new toplevel heading at the end of | 65 | ;; the user wishes to append 'tag' as a new toplevel heading at the end of |
| 66 | ;; the buffer; and finally, defer to org's default behaviour which is to | 66 | ;; the buffer; and finally, defer to org's default behavior which is to |
| 67 | ;; search the entire text of the current buffer for 'tag'. | 67 | ;; search the entire text of the current buffer for 'tag'. |
| 68 | ;; | 68 | ;; |
| 69 | ;; This behaviour can be modified by changing the value of | 69 | ;; This behavior can be modified by changing the value of |
| 70 | ;; ORG-CTAGS-OPEN-LINK-FUNCTIONS. For example I have the following in my | 70 | ;; ORG-CTAGS-OPEN-LINK-FUNCTIONS. For example I have the following in my |
| 71 | ;; .emacs, which describes the same behaviour as the above paragraph with | 71 | ;; .emacs, which describes the same behavior as the above paragraph with |
| 72 | ;; one difference: | 72 | ;; one difference: |
| 73 | ;; | 73 | ;; |
| 74 | ;; (setq org-ctags-open-link-functions | 74 | ;; (setq org-ctags-open-link-functions |
| 75 | ;; '(org-ctags-find-tag | 75 | ;; '(org-ctags-find-tag |
| 76 | ;; org-ctags-ask-rebuild-tags-file-then-find-tag | 76 | ;; org-ctags-ask-rebuild-tags-file-then-find-tag |
| 77 | ;; org-ctags-ask-append-topic | 77 | ;; org-ctags-ask-append-topic |
| 78 | ;; org-ctags-fail-silently)) ; <-- prevents org default behaviour | 78 | ;; org-ctags-fail-silently)) ; <-- prevents org default behavior |
| 79 | ;; | 79 | ;; |
| 80 | ;; | 80 | ;; |
| 81 | ;; Usage | 81 | ;; Usage |
diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el index a3f0b501da6..c952a826db8 100644 --- a/lisp/org/ox-html.el +++ b/lisp/org/ox-html.el | |||
| @@ -581,7 +581,7 @@ The function must accept two parameters: | |||
| 581 | The function should return the string to be exported. | 581 | The function should return the string to be exported. |
| 582 | 582 | ||
| 583 | For example, the variable could be set to the following function | 583 | For example, the variable could be set to the following function |
| 584 | in order to mimic default behaviour: | 584 | in order to mimic default behavior: |
| 585 | 585 | ||
| 586 | The default value simply returns the value of CONTENTS." | 586 | The default value simply returns the value of CONTENTS." |
| 587 | :group 'org-export-html | 587 | :group 'org-export-html |
diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el index 2c71f7d785a..f6f3b220b43 100644 --- a/lisp/org/ox-latex.el +++ b/lisp/org/ox-latex.el | |||
| @@ -589,7 +589,7 @@ The function must accept six parameters: | |||
| 589 | The function should return the string to be exported. | 589 | The function should return the string to be exported. |
| 590 | 590 | ||
| 591 | For example, the variable could be set to the following function | 591 | For example, the variable could be set to the following function |
| 592 | in order to mimic default behaviour: | 592 | in order to mimic default behavior: |
| 593 | 593 | ||
| 594 | \(defun org-latex-format-inlinetask \(todo type priority name tags contents\) | 594 | \(defun org-latex-format-inlinetask \(todo type priority name tags contents\) |
| 595 | \"Format an inline task element for LaTeX export.\" | 595 | \"Format an inline task element for LaTeX export.\" |
diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el index efc70d22a83..b33ba459877 100644 --- a/lisp/org/ox-publish.el +++ b/lisp/org/ox-publish.el | |||
| @@ -228,7 +228,7 @@ If you create a site-map file, adjust the sorting like this: | |||
| 228 | `:sitemap-sort-files' | 228 | `:sitemap-sort-files' |
| 229 | 229 | ||
| 230 | The site map is normally sorted alphabetically. You can | 230 | The site map is normally sorted alphabetically. You can |
| 231 | change this behaviour setting this to `anti-chronologically', | 231 | change this behavior setting this to `anti-chronologically', |
| 232 | `chronologically', or nil. | 232 | `chronologically', or nil. |
| 233 | 233 | ||
| 234 | `:sitemap-ignore-case' | 234 | `:sitemap-ignore-case' |
diff --git a/lisp/org/ox.el b/lisp/org/ox.el index 1327ae409ed..2b0978dfdf0 100644 --- a/lisp/org/ox.el +++ b/lisp/org/ox.el | |||
| @@ -493,7 +493,7 @@ t Allow export of math snippets." | |||
| 493 | "The last level which is still exported as a headline. | 493 | "The last level which is still exported as a headline. |
| 494 | 494 | ||
| 495 | Inferior levels will usually produce itemize or enumerate lists | 495 | Inferior levels will usually produce itemize or enumerate lists |
| 496 | when exported, but back-end behaviour may differ. | 496 | when exported, but back-end behavior may differ. |
| 497 | 497 | ||
| 498 | This option can also be set with the OPTIONS keyword, | 498 | This option can also be set with the OPTIONS keyword, |
| 499 | e.g. \"H:2\"." | 499 | e.g. \"H:2\"." |
| @@ -1736,13 +1736,13 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored." | |||
| 1736 | (t | 1736 | (t |
| 1737 | ;; Options in `org-export-options-alist'. | 1737 | ;; Options in `org-export-options-alist'. |
| 1738 | (dolist (property (funcall find-properties key)) | 1738 | (dolist (property (funcall find-properties key)) |
| 1739 | (let ((behaviour (nth 4 (assq property options)))) | 1739 | (let ((behavior (nth 4 (assq property options)))) |
| 1740 | (setq plist | 1740 | (setq plist |
| 1741 | (plist-put | 1741 | (plist-put |
| 1742 | plist property | 1742 | plist property |
| 1743 | ;; Handle value depending on specified | 1743 | ;; Handle value depending on specified |
| 1744 | ;; BEHAVIOR. | 1744 | ;; BEHAVIOR. |
| 1745 | (case behaviour | 1745 | (case behavior |
| 1746 | (space | 1746 | (space |
| 1747 | (if (not (plist-get plist property)) | 1747 | (if (not (plist-get plist property)) |
| 1748 | (org-trim val) | 1748 | (org-trim val) |
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index ef619f0899a..c6cab1257a5 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el | |||
| @@ -418,40 +418,19 @@ It can be quoted, or be inside a quoted form." | |||
| 418 | (match-string 0 doc)))) | 418 | (match-string 0 doc)))) |
| 419 | 419 | ||
| 420 | (declare-function find-library-name "find-func" (library)) | 420 | (declare-function find-library-name "find-func" (library)) |
| 421 | 421 | (declare-function find-function-library "find-func" (function &optional l-o v)) | |
| 422 | (defvar elisp--identifier-types '(defun defvar feature defface)) | ||
| 423 | |||
| 424 | (defun elisp--identifier-location (type sym) | ||
| 425 | (pcase (cons type sym) | ||
| 426 | (`(defun . ,(pred fboundp)) | ||
| 427 | (find-definition-noselect sym nil)) | ||
| 428 | (`(defvar . ,(pred boundp)) | ||
| 429 | (find-definition-noselect sym 'defvar)) | ||
| 430 | (`(defface . ,(pred facep)) | ||
| 431 | (find-definition-noselect sym 'defface)) | ||
| 432 | (`(feature . ,(pred featurep)) | ||
| 433 | (require 'find-func) | ||
| 434 | (cons (find-file-noselect (find-library-name | ||
| 435 | (symbol-name sym))) | ||
| 436 | 1)))) | ||
| 437 | 422 | ||
| 438 | (defun elisp--company-location (str) | 423 | (defun elisp--company-location (str) |
| 439 | (catch 'res | 424 | (let ((sym (intern-soft str))) |
| 440 | (let ((sym (intern-soft str))) | 425 | (cond |
| 441 | (when sym | 426 | ((fboundp sym) (find-definition-noselect sym nil)) |
| 442 | (dolist (type elisp--identifier-types) | 427 | ((boundp sym) (find-definition-noselect sym 'defvar)) |
| 443 | (let ((loc (elisp--identifier-location type sym))) | 428 | ((featurep sym) |
| 444 | (and loc (throw 'res loc)))))))) | 429 | (require 'find-func) |
| 445 | 430 | (cons (find-file-noselect (find-library-name | |
| 446 | (defvar elisp--identifier-completion-table | 431 | (symbol-name sym))) |
| 447 | (apply-partially #'completion-table-with-predicate | 432 | 0)) |
| 448 | obarray | 433 | ((facep sym) (find-definition-noselect sym 'defface))))) |
| 449 | (lambda (sym) | ||
| 450 | (or (boundp sym) | ||
| 451 | (fboundp sym) | ||
| 452 | (featurep sym) | ||
| 453 | (symbol-plist sym))) | ||
| 454 | 'strict)) | ||
| 455 | 434 | ||
| 456 | (defun elisp-completion-at-point () | 435 | (defun elisp-completion-at-point () |
| 457 | "Function used for `completion-at-point-functions' in `emacs-lisp-mode'." | 436 | "Function used for `completion-at-point-functions' in `emacs-lisp-mode'." |
| @@ -493,8 +472,13 @@ It can be quoted, or be inside a quoted form." | |||
| 493 | :company-docsig #'elisp--company-doc-string | 472 | :company-docsig #'elisp--company-doc-string |
| 494 | :company-location #'elisp--company-location)) | 473 | :company-location #'elisp--company-location)) |
| 495 | ((elisp--form-quoted-p beg) | 474 | ((elisp--form-quoted-p beg) |
| 496 | ;; Don't include all symbols (bug#16646). | 475 | (list nil obarray |
| 497 | (list nil elisp--identifier-completion-table | 476 | ;; Don't include all symbols (bug#16646). |
| 477 | :predicate (lambda (sym) | ||
| 478 | (or (boundp sym) | ||
| 479 | (fboundp sym) | ||
| 480 | (featurep sym) | ||
| 481 | (symbol-plist sym))) | ||
| 498 | :annotation-function | 482 | :annotation-function |
| 499 | (lambda (str) (if (fboundp (intern-soft str)) " <f>")) | 483 | (lambda (str) (if (fboundp (intern-soft str)) " <f>")) |
| 500 | :company-doc-buffer #'elisp--company-doc-buffer | 484 | :company-doc-buffer #'elisp--company-doc-buffer |
| @@ -572,11 +556,12 @@ It can be quoted, or be inside a quoted form." | |||
| 572 | 556 | ||
| 573 | ;;; Xref backend | 557 | ;;; Xref backend |
| 574 | 558 | ||
| 575 | (declare-function xref-make-buffer-location "xref" (buffer position)) | 559 | (declare-function xref-make-elisp-location "xref" (symbol type file)) |
| 576 | (declare-function xref-make-bogus-location "xref" (message)) | 560 | (declare-function xref-make-bogus-location "xref" (message)) |
| 577 | (declare-function xref-make "xref" (description location)) | 561 | (declare-function xref-make "xref" (description location)) |
| 578 | 562 | ||
| 579 | (defun elisp-xref-find (action id) | 563 | (defun elisp-xref-find (action id) |
| 564 | (require 'find-func) | ||
| 580 | (pcase action | 565 | (pcase action |
| 581 | (`definitions | 566 | (`definitions |
| 582 | (let ((sym (intern-soft id))) | 567 | (let ((sym (intern-soft id))) |
| @@ -585,16 +570,34 @@ It can be quoted, or be inside a quoted form." | |||
| 585 | (`apropos | 570 | (`apropos |
| 586 | (elisp--xref-find-apropos id)))) | 571 | (elisp--xref-find-apropos id)))) |
| 587 | 572 | ||
| 573 | (defun elisp--xref-identifier-location (type sym) | ||
| 574 | (let ((file | ||
| 575 | (pcase type | ||
| 576 | (`defun (when (fboundp sym) | ||
| 577 | (let ((fun-lib | ||
| 578 | (find-function-library sym))) | ||
| 579 | (setq sym (car fun-lib)) | ||
| 580 | (cdr fun-lib)))) | ||
| 581 | (`defvar (when (boundp sym) | ||
| 582 | (or (symbol-file sym 'defvar) | ||
| 583 | (help-C-file-name sym 'var)))) | ||
| 584 | (`feature (when (featurep sym) | ||
| 585 | (ignore-errors | ||
| 586 | (find-library-name (symbol-name sym))))) | ||
| 587 | (`defface (when (facep sym) | ||
| 588 | (symbol-file sym 'defface)))))) | ||
| 589 | (when file | ||
| 590 | (when (string-match-p "\\.elc\\'" file) | ||
| 591 | (setq file (substring file 0 -1))) | ||
| 592 | (xref-make-elisp-location sym type file)))) | ||
| 593 | |||
| 588 | (defun elisp--xref-find-definitions (symbol) | 594 | (defun elisp--xref-find-definitions (symbol) |
| 589 | (save-excursion | 595 | (save-excursion |
| 590 | (let (lst) | 596 | (let (lst) |
| 591 | (dolist (type elisp--identifier-types) | 597 | (dolist (type '(feature defface defvar defun)) |
| 592 | (let ((loc | 598 | (let ((loc |
| 593 | (condition-case err | 599 | (condition-case err |
| 594 | (let ((buf-pos (elisp--identifier-location type symbol))) | 600 | (elisp--xref-identifier-location type symbol) |
| 595 | (when buf-pos | ||
| 596 | (xref-make-buffer-location (car buf-pos) | ||
| 597 | (or (cdr buf-pos) 1)))) | ||
| 598 | (error | 601 | (error |
| 599 | (xref-make-bogus-location (error-message-string err)))))) | 602 | (xref-make-bogus-location (error-message-string err)))))) |
| 600 | (when loc | 603 | (when loc |
| @@ -611,8 +614,18 @@ It can be quoted, or be inside a quoted form." | |||
| 611 | (push (elisp--xref-find-definitions sym) lst)) | 614 | (push (elisp--xref-find-definitions sym) lst)) |
| 612 | (nreverse lst)))) | 615 | (nreverse lst)))) |
| 613 | 616 | ||
| 617 | (defvar elisp--xref-identifier-completion-table | ||
| 618 | (apply-partially #'completion-table-with-predicate | ||
| 619 | obarray | ||
| 620 | (lambda (sym) | ||
| 621 | (or (boundp sym) | ||
| 622 | (fboundp sym) | ||
| 623 | (featurep sym) | ||
| 624 | (facep sym))) | ||
| 625 | 'strict)) | ||
| 626 | |||
| 614 | (defun elisp--xref-identifier-completion-table () | 627 | (defun elisp--xref-identifier-completion-table () |
| 615 | elisp--identifier-completion-table) | 628 | elisp--xref-identifier-completion-table) |
| 616 | 629 | ||
| 617 | ;;; Elisp Interaction mode | 630 | ;;; Elisp Interaction mode |
| 618 | 631 | ||
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 0be99794356..be0dabf17b2 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el | |||
| @@ -975,6 +975,7 @@ onto a ring and may be popped back to with \\[pop-tag-mark]. | |||
| 975 | Contrast this with the ring of marks gone to by the command. | 975 | Contrast this with the ring of marks gone to by the command. |
| 976 | 976 | ||
| 977 | See documentation of variable `tags-file-name'." | 977 | See documentation of variable `tags-file-name'." |
| 978 | (declare (obsolete xref-find-definitions-other-window "25.1")) | ||
| 978 | (interactive (find-tag-interactive "Find tag other window: ")) | 979 | (interactive (find-tag-interactive "Find tag other window: ")) |
| 979 | 980 | ||
| 980 | ;; This hair is to deal with the case where the tag is found in the | 981 | ;; This hair is to deal with the case where the tag is found in the |
| @@ -1015,6 +1016,7 @@ onto a ring and may be popped back to with \\[pop-tag-mark]. | |||
| 1015 | Contrast this with the ring of marks gone to by the command. | 1016 | Contrast this with the ring of marks gone to by the command. |
| 1016 | 1017 | ||
| 1017 | See documentation of variable `tags-file-name'." | 1018 | See documentation of variable `tags-file-name'." |
| 1019 | (declare (obsolete xref-find-definitions-other-frame "25.1")) | ||
| 1018 | (interactive (find-tag-interactive "Find tag other frame: ")) | 1020 | (interactive (find-tag-interactive "Find tag other frame: ")) |
| 1019 | (let ((pop-up-frames t)) | 1021 | (let ((pop-up-frames t)) |
| 1020 | (find-tag-other-window tagname next-p))) | 1022 | (find-tag-other-window tagname next-p))) |
| @@ -1037,6 +1039,7 @@ onto a ring and may be popped back to with \\[pop-tag-mark]. | |||
| 1037 | Contrast this with the ring of marks gone to by the command. | 1039 | Contrast this with the ring of marks gone to by the command. |
| 1038 | 1040 | ||
| 1039 | See documentation of variable `tags-file-name'." | 1041 | See documentation of variable `tags-file-name'." |
| 1042 | (declare (obsolete xref-find-apropos "25.1")) | ||
| 1040 | (interactive (find-tag-interactive "Find tag regexp: " t)) | 1043 | (interactive (find-tag-interactive "Find tag regexp: " t)) |
| 1041 | ;; We go through find-tag-other-window to do all the display hair there. | 1044 | ;; We go through find-tag-other-window to do all the display hair there. |
| 1042 | (funcall (if other-window 'find-tag-other-window 'find-tag) | 1045 | (funcall (if other-window 'find-tag-other-window 'find-tag) |
| @@ -1786,6 +1789,7 @@ Two variables control the processing we do on each file: the value of | |||
| 1786 | interesting (it returns non-nil if so) and `tags-loop-operate' is a form to | 1789 | interesting (it returns non-nil if so) and `tags-loop-operate' is a form to |
| 1787 | evaluate to operate on an interesting file. If the latter evaluates to | 1790 | evaluate to operate on an interesting file. If the latter evaluates to |
| 1788 | nil, we exit; otherwise we scan the next file." | 1791 | nil, we exit; otherwise we scan the next file." |
| 1792 | (declare (obsolete "use `xref-find-definitions' interface instead." "25.1")) | ||
| 1789 | (interactive) | 1793 | (interactive) |
| 1790 | (let (new | 1794 | (let (new |
| 1791 | ;; Non-nil means we have finished one file | 1795 | ;; Non-nil means we have finished one file |
| @@ -1929,6 +1933,7 @@ directory specification." | |||
| 1929 | ;;;###autoload | 1933 | ;;;###autoload |
| 1930 | (defun tags-apropos (regexp) | 1934 | (defun tags-apropos (regexp) |
| 1931 | "Display list of all tags in tags table REGEXP matches." | 1935 | "Display list of all tags in tags table REGEXP matches." |
| 1936 | (declare (obsolete xref-find-apropos "25.1")) | ||
| 1932 | (interactive "sTags apropos (regexp): ") | 1937 | (interactive "sTags apropos (regexp): ") |
| 1933 | (with-output-to-temp-buffer "*Tags List*" | 1938 | (with-output-to-temp-buffer "*Tags List*" |
| 1934 | (princ "Click mouse-2 to follow tags.\n\nTags matching regexp `") | 1939 | (princ "Click mouse-2 to follow tags.\n\nTags matching regexp `") |
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 45074d338d3..f6a9440610e 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el | |||
| @@ -1673,7 +1673,7 @@ This performs fontification according to `js--class-styles'." | |||
| 1673 | ;; We can probably just add +, -, !, <, >, %, ^, ~, |, &, ?, : at which | 1673 | ;; We can probably just add +, -, !, <, >, %, ^, ~, |, &, ?, : at which |
| 1674 | ;; point I think only * and / would be missing which could also be added, | 1674 | ;; point I think only * and / would be missing which could also be added, |
| 1675 | ;; but need care to avoid affecting the // and */ comment markers. | 1675 | ;; but need care to avoid affecting the // and */ comment markers. |
| 1676 | ("\\(?:^\\|[=([{,:;]\\)\\(?:[ \t]\\)*\\(/\\)[^/*]" | 1676 | ("\\(?:^\\|[=([{,:;]\\|\\_<return\\_>\\)\\(?:[ \t]\\)*\\(/\\)[^/*]" |
| 1677 | (1 (ignore | 1677 | (1 (ignore |
| 1678 | (forward-char -1) | 1678 | (forward-char -1) |
| 1679 | (when (or (not (memq (char-after (match-beginning 0)) '(?\s ?\t))) | 1679 | (when (or (not (memq (char-after (match-beginning 0)) '(?\s ?\t))) |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 35e24e14e1c..c46c5d68019 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -69,7 +69,7 @@ | |||
| 69 | ;; Besides that only the standard CPython (2.x and 3.x) shell and | 69 | ;; Besides that only the standard CPython (2.x and 3.x) shell and |
| 70 | ;; IPython are officially supported out of the box, the interaction | 70 | ;; IPython are officially supported out of the box, the interaction |
| 71 | ;; should support any other readline based Python shells as well | 71 | ;; should support any other readline based Python shells as well |
| 72 | ;; (e.g. Jython and Pypy have been reported to work). You can change | 72 | ;; (e.g. Jython and PyPy have been reported to work). You can change |
| 73 | ;; your default interpreter and commandline arguments by setting the | 73 | ;; your default interpreter and commandline arguments by setting the |
| 74 | ;; `python-shell-interpreter' and `python-shell-interpreter-args' | 74 | ;; `python-shell-interpreter' and `python-shell-interpreter-args' |
| 75 | ;; variables. This example enables IPython globally: | 75 | ;; variables. This example enables IPython globally: |
| @@ -119,18 +119,24 @@ | |||
| 119 | ;; modify its behavior. | 119 | ;; modify its behavior. |
| 120 | 120 | ||
| 121 | ;; Shell completion: hitting tab will try to complete the current | 121 | ;; Shell completion: hitting tab will try to complete the current |
| 122 | ;; word. Shell completion is implemented in such way that if you | 122 | ;; word. The two built-in mechanisms depend on Python's readline |
| 123 | ;; change the `python-shell-interpreter' it should be possible to | 123 | ;; module: the "native" completion is tried first and is activated |
| 124 | ;; integrate custom logic to calculate completions. To achieve this | 124 | ;; when `python-shell-completion-native-enable' is non-nil, the |
| 125 | ;; you just need to set `python-shell-completion-setup-code' and | 125 | ;; current `python-shell-interpreter' is not a member of the |
| 126 | ;; `python-shell-completion-string-code'. The default provided code, | 126 | ;; `python-shell-completion-native-disabled-interpreters' variable and |
| 127 | ;; enables autocompletion for both CPython and IPython (and ideally | 127 | ;; `python-shell-completion-native-setup' succeeds; the "fallback" or |
| 128 | ;; any readline based Python shell). This code depends on the | 128 | ;; "legacy" mechanism works by executing Python code in the background |
| 129 | ;; readline module, so if you are using some Operating System that | 129 | ;; and enables auto-completion for shells that do not support |
| 130 | ;; bundles Python without it (like Windows), installing pyreadline | 130 | ;; receiving escape sequences (with some limitations, i.e. completion |
| 131 | ;; from URL `http://ipython.scipy.org/moin/PyReadline/Intro' should | 131 | ;; in blocks does not work). The code executed for the "fallback" |
| 132 | ;; suffice. To troubleshoot why you are not getting any completions | 132 | ;; completion can be found in `python-shell-completion-setup-code' and |
| 133 | ;; you can try the following in your Python shell: | 133 | ;; `python-shell-completion-string-code' variables. Their default |
| 134 | ;; values enable completion for both CPython and IPython, and probably | ||
| 135 | ;; any readline based shell (it's known to work with PyPy). If your | ||
| 136 | ;; Python installation lacks readline (like CPython for Windows), | ||
| 137 | ;; installing pyreadline (URL `http://ipython.org/pyreadline.html') | ||
| 138 | ;; should suffice. To troubleshoot why you are not getting any | ||
| 139 | ;; completions, you can try the following in your Python shell: | ||
| 134 | 140 | ||
| 135 | ;; >>> import readline, rlcompleter | 141 | ;; >>> import readline, rlcompleter |
| 136 | 142 | ||
| @@ -256,6 +262,7 @@ | |||
| 256 | (defvar outline-heading-end-regexp) | 262 | (defvar outline-heading-end-regexp) |
| 257 | 263 | ||
| 258 | (autoload 'comint-mode "comint") | 264 | (autoload 'comint-mode "comint") |
| 265 | (autoload 'help-function-arglist "help-fns") | ||
| 259 | 266 | ||
| 260 | ;;;###autoload | 267 | ;;;###autoload |
| 261 | (add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode)) | 268 | (add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode)) |
| @@ -395,7 +402,18 @@ | |||
| 395 | (* ?\\ ?\\) (any ?\' ?\"))) | 402 | (* ?\\ ?\\) (any ?\' ?\"))) |
| 396 | (* ?\\ ?\\) | 403 | (* ?\\ ?\\) |
| 397 | ;; Match single or triple quotes of any kind. | 404 | ;; Match single or triple quotes of any kind. |
| 398 | (group (or "\"" "\"\"\"" "'" "'''")))))) | 405 | (group (or "\"" "\"\"\"" "'" "'''"))))) |
| 406 | (coding-cookie . ,(rx line-start ?# (* space) | ||
| 407 | (or | ||
| 408 | ;; # coding=<encoding name> | ||
| 409 | (: "coding" (or ?: ?=) (* space) (group-n 1 (+ (or word ?-)))) | ||
| 410 | ;; # -*- coding: <encoding name> -*- | ||
| 411 | (: "-*-" (* space) "coding:" (* space) | ||
| 412 | (group-n 1 (+ (or word ?-))) (* space) "-*-") | ||
| 413 | ;; # vim: set fileencoding=<encoding name> : | ||
| 414 | (: "vim:" (* space) "set" (+ space) | ||
| 415 | "fileencoding" (* space) ?= (* space) | ||
| 416 | (group-n 1 (+ (or word ?-))) (* space) ":"))))) | ||
| 399 | "Additional Python specific sexps for `python-rx'") | 417 | "Additional Python specific sexps for `python-rx'") |
| 400 | 418 | ||
| 401 | (defmacro python-rx (&rest regexps) | 419 | (defmacro python-rx (&rest regexps) |
| @@ -1206,12 +1224,18 @@ the line will be re-indented automatically if needed." | |||
| 1206 | (eolp) | 1224 | (eolp) |
| 1207 | ;; Avoid re-indenting on extra colon | 1225 | ;; Avoid re-indenting on extra colon |
| 1208 | (not (equal ?: (char-before (1- (point))))) | 1226 | (not (equal ?: (char-before (1- (point))))) |
| 1209 | (not (python-syntax-comment-or-string-p)) | 1227 | (not (python-syntax-comment-or-string-p))) |
| 1210 | ;; Never re-indent at beginning of defun | 1228 | ;; Just re-indent dedenters |
| 1211 | (not (save-excursion | 1229 | (let ((dedenter-pos (python-info-dedenter-statement-p)) |
| 1212 | (python-nav-beginning-of-statement) | 1230 | (current-pos (point))) |
| 1213 | (python-info-looking-at-beginning-of-defun)))) | 1231 | (when dedenter-pos |
| 1214 | (python-indent-line))))) | 1232 | (save-excursion |
| 1233 | (goto-char dedenter-pos) | ||
| 1234 | (python-indent-line) | ||
| 1235 | (unless (= (line-number-at-pos dedenter-pos) | ||
| 1236 | (line-number-at-pos current-pos)) | ||
| 1237 | ;; Reindent region if this is a multiline statement | ||
| 1238 | (python-indent-region dedenter-pos current-pos))))))))) | ||
| 1215 | 1239 | ||
| 1216 | 1240 | ||
| 1217 | ;;; Navigation | 1241 | ;;; Navigation |
| @@ -2087,36 +2111,18 @@ and `python-shell-output-prompt-regexp' using the values from | |||
| 2087 | 2111 | ||
| 2088 | (defun python-shell-get-process-name (dedicated) | 2112 | (defun python-shell-get-process-name (dedicated) |
| 2089 | "Calculate the appropriate process name for inferior Python process. | 2113 | "Calculate the appropriate process name for inferior Python process. |
| 2090 | If DEDICATED is t and the variable `buffer-file-name' is non-nil | 2114 | If DEDICATED is t returns a string with the form |
| 2091 | returns a string with the form | 2115 | `python-shell-buffer-name'[`buffer-name'] else returns the value |
| 2092 | `python-shell-buffer-name'[variable `buffer-file-name'] else | 2116 | of `python-shell-buffer-name'." |
| 2093 | returns the value of `python-shell-buffer-name'." | 2117 | (if dedicated |
| 2094 | (let ((process-name | 2118 | (format "%s[%s]" python-shell-buffer-name (buffer-name)) |
| 2095 | (if (and dedicated | 2119 | python-shell-buffer-name)) |
| 2096 | buffer-file-name) | ||
| 2097 | (format "%s[%s]" python-shell-buffer-name buffer-file-name) | ||
| 2098 | (format "%s" python-shell-buffer-name)))) | ||
| 2099 | process-name)) | ||
| 2100 | 2120 | ||
| 2101 | (defun python-shell-internal-get-process-name () | 2121 | (defun python-shell-internal-get-process-name () |
| 2102 | "Calculate the appropriate process name for Internal Python process. | 2122 | "Calculate the appropriate process name for Internal Python process. |
| 2103 | The name is calculated from `python-shell-global-buffer-name' and | 2123 | The name is calculated from `python-shell-global-buffer-name' and |
| 2104 | a hash of all relevant global shell settings in order to ensure | 2124 | the `buffer-name'." |
| 2105 | uniqueness for different types of configurations." | 2125 | (format "%s[%s]" python-shell-internal-buffer-name (buffer-name))) |
| 2106 | (format "%s [%s]" | ||
| 2107 | python-shell-internal-buffer-name | ||
| 2108 | (md5 | ||
| 2109 | (concat | ||
| 2110 | python-shell-interpreter | ||
| 2111 | python-shell-interpreter-args | ||
| 2112 | python-shell--prompt-calculated-input-regexp | ||
| 2113 | python-shell--prompt-calculated-output-regexp | ||
| 2114 | (mapconcat #'symbol-value python-shell-setup-codes "") | ||
| 2115 | (mapconcat #'identity python-shell-process-environment "") | ||
| 2116 | (mapconcat #'identity python-shell-extra-pythonpaths "") | ||
| 2117 | (mapconcat #'identity python-shell-exec-path "") | ||
| 2118 | (or python-shell-virtualenv-root "") | ||
| 2119 | (mapconcat #'identity python-shell-exec-path ""))))) | ||
| 2120 | 2126 | ||
| 2121 | (defun python-shell-calculate-command () | 2127 | (defun python-shell-calculate-command () |
| 2122 | "Calculate the string used to execute the inferior Python process." | 2128 | "Calculate the string used to execute the inferior Python process." |
| @@ -2256,11 +2262,9 @@ Avoids `recenter' calls until OUTPUT is completely sent." | |||
| 2256 | "Execute the forms in BODY with the shell buffer temporarily current. | 2262 | "Execute the forms in BODY with the shell buffer temporarily current. |
| 2257 | Signals an error if no shell buffer is available for current buffer." | 2263 | Signals an error if no shell buffer is available for current buffer." |
| 2258 | (declare (indent 0) (debug t)) | 2264 | (declare (indent 0) (debug t)) |
| 2259 | (let ((shell-buffer (make-symbol "shell-buffer"))) | 2265 | (let ((shell-process (make-symbol "shell-process"))) |
| 2260 | `(let ((,shell-buffer (python-shell-get-buffer))) | 2266 | `(let ((,shell-process (python-shell-get-process-or-error))) |
| 2261 | (when (not ,shell-buffer) | 2267 | (with-current-buffer (process-buffer ,shell-process) |
| 2262 | (error "No inferior Python buffer available.")) | ||
| 2263 | (with-current-buffer ,shell-buffer | ||
| 2264 | ,@body)))) | 2268 | ,@body)))) |
| 2265 | 2269 | ||
| 2266 | (defvar python-shell--font-lock-buffer nil) | 2270 | (defvar python-shell--font-lock-buffer nil) |
| @@ -2472,12 +2476,12 @@ variable. | |||
| 2472 | (python-shell-accept-process-output | 2476 | (python-shell-accept-process-output |
| 2473 | (get-buffer-process (current-buffer)))) | 2477 | (get-buffer-process (current-buffer)))) |
| 2474 | 2478 | ||
| 2475 | (defun python-shell-make-comint (cmd proc-name &optional pop internal) | 2479 | (defun python-shell-make-comint (cmd proc-name &optional show internal) |
| 2476 | "Create a Python shell comint buffer. | 2480 | "Create a Python shell comint buffer. |
| 2477 | CMD is the Python command to be executed and PROC-NAME is the | 2481 | CMD is the Python command to be executed and PROC-NAME is the |
| 2478 | process name the comint buffer will get. After the comint buffer | 2482 | process name the comint buffer will get. After the comint buffer |
| 2479 | is created the `inferior-python-mode' is activated. When | 2483 | is created the `inferior-python-mode' is activated. When |
| 2480 | optional argument POP is non-nil the buffer is shown. When | 2484 | optional argument SHOW is non-nil the buffer is shown. When |
| 2481 | optional argument INTERNAL is non-nil this process is run on a | 2485 | optional argument INTERNAL is non-nil this process is run on a |
| 2482 | buffer with a name that starts with a space, following the Emacs | 2486 | buffer with a name that starts with a space, following the Emacs |
| 2483 | convention for temporary/internal buffers, and also makes sure | 2487 | convention for temporary/internal buffers, and also makes sure |
| @@ -2506,16 +2510,13 @@ killed." | |||
| 2506 | (mapconcat #'identity args " "))) | 2510 | (mapconcat #'identity args " "))) |
| 2507 | (with-current-buffer buffer | 2511 | (with-current-buffer buffer |
| 2508 | (inferior-python-mode)) | 2512 | (inferior-python-mode)) |
| 2509 | (and pop (pop-to-buffer buffer t)) | 2513 | (when show (display-buffer buffer)) |
| 2510 | (and internal (set-process-query-on-exit-flag process nil)))) | 2514 | (and internal (set-process-query-on-exit-flag process nil)))) |
| 2511 | proc-buffer-name))) | 2515 | proc-buffer-name))) |
| 2512 | 2516 | ||
| 2513 | ;;;###autoload | 2517 | ;;;###autoload |
| 2514 | (defun run-python (&optional cmd dedicated show) | 2518 | (defun run-python (&optional cmd dedicated show) |
| 2515 | "Run an inferior Python process. | 2519 | "Run an inferior Python process. |
| 2516 | Input and output via buffer named after | ||
| 2517 | `python-shell-buffer-name'. If there is a process already | ||
| 2518 | running in that buffer, just switch to it. | ||
| 2519 | 2520 | ||
| 2520 | Argument CMD defaults to `python-shell-calculate-command' return | 2521 | Argument CMD defaults to `python-shell-calculate-command' return |
| 2521 | value. When called interactively with `prefix-arg', it allows | 2522 | value. When called interactively with `prefix-arg', it allows |
| @@ -2523,6 +2524,11 @@ the user to edit such value and choose whether the interpreter | |||
| 2523 | should be DEDICATED for the current buffer. When numeric prefix | 2524 | should be DEDICATED for the current buffer. When numeric prefix |
| 2524 | arg is other than 0 or 4 do not SHOW. | 2525 | arg is other than 0 or 4 do not SHOW. |
| 2525 | 2526 | ||
| 2527 | For a given buffer and same values of DEDICATED, if a process is | ||
| 2528 | already running for it, it will do nothing. This means that if | ||
| 2529 | the current buffer is using a global process, the user is still | ||
| 2530 | able to switch it to use a dedicated one. | ||
| 2531 | |||
| 2526 | Runs the hook `inferior-python-mode-hook' after | 2532 | Runs the hook `inferior-python-mode-hook' after |
| 2527 | `comint-mode-hook' is run. (Type \\[describe-mode] in the | 2533 | `comint-mode-hook' is run. (Type \\[describe-mode] in the |
| 2528 | process buffer for a list of commands.)" | 2534 | process buffer for a list of commands.)" |
| @@ -2533,10 +2539,10 @@ process buffer for a list of commands.)" | |||
| 2533 | (y-or-n-p "Make dedicated process? ") | 2539 | (y-or-n-p "Make dedicated process? ") |
| 2534 | (= (prefix-numeric-value current-prefix-arg) 4)) | 2540 | (= (prefix-numeric-value current-prefix-arg) 4)) |
| 2535 | (list (python-shell-calculate-command) nil t))) | 2541 | (list (python-shell-calculate-command) nil t))) |
| 2536 | (python-shell-make-comint | 2542 | (get-buffer-process |
| 2537 | (or cmd (python-shell-calculate-command)) | 2543 | (python-shell-make-comint |
| 2538 | (python-shell-get-process-name dedicated) show) | 2544 | (or cmd (python-shell-calculate-command)) |
| 2539 | dedicated) | 2545 | (python-shell-get-process-name dedicated) show))) |
| 2540 | 2546 | ||
| 2541 | (defun run-python-internal () | 2547 | (defun run-python-internal () |
| 2542 | "Run an inferior Internal Python process. | 2548 | "Run an inferior Internal Python process. |
| @@ -2579,6 +2585,21 @@ If current buffer is in `inferior-python-mode', return it." | |||
| 2579 | "Return inferior Python process for current buffer." | 2585 | "Return inferior Python process for current buffer." |
| 2580 | (get-buffer-process (python-shell-get-buffer))) | 2586 | (get-buffer-process (python-shell-get-buffer))) |
| 2581 | 2587 | ||
| 2588 | (defun python-shell-get-process-or-error (&optional interactivep) | ||
| 2589 | "Return inferior Python process for current buffer or signal error. | ||
| 2590 | When argument INTERACTIVEP is non-nil, use `user-error' instead | ||
| 2591 | of `error' with a user-friendly message." | ||
| 2592 | (or (python-shell-get-process) | ||
| 2593 | (if interactivep | ||
| 2594 | (user-error | ||
| 2595 | "Start a Python process first with `M-x run-python' or `%s'." | ||
| 2596 | ;; Get the binding. | ||
| 2597 | (key-description | ||
| 2598 | (where-is-internal | ||
| 2599 | #'run-python overriding-local-map t))) | ||
| 2600 | (error | ||
| 2601 | "No inferior Python process running.")))) | ||
| 2602 | |||
| 2582 | (defun python-shell-get-or-create-process (&optional cmd dedicated show) | 2603 | (defun python-shell-get-or-create-process (&optional cmd dedicated show) |
| 2583 | "Get or create an inferior Python process for current buffer and return it. | 2604 | "Get or create an inferior Python process for current buffer and return it. |
| 2584 | Arguments CMD, DEDICATED and SHOW are those of `run-python' and | 2605 | Arguments CMD, DEDICATED and SHOW are those of `run-python' and |
| @@ -2594,6 +2615,11 @@ be asked for their values." | |||
| 2594 | (run-python cmd dedicated show))) | 2615 | (run-python cmd dedicated show))) |
| 2595 | (or shell-process (python-shell-get-process)))) | 2616 | (or shell-process (python-shell-get-process)))) |
| 2596 | 2617 | ||
| 2618 | (make-obsolete | ||
| 2619 | #'python-shell-get-or-create-process | ||
| 2620 | "Instead call `python-shell-get-process' and create one if returns nil." | ||
| 2621 | "25.1") | ||
| 2622 | |||
| 2597 | (defvar python-shell-internal-buffer nil | 2623 | (defvar python-shell-internal-buffer nil |
| 2598 | "Current internal shell buffer for the current buffer. | 2624 | "Current internal shell buffer for the current buffer. |
| 2599 | This is really not necessary at all for the code to work but it's | 2625 | This is really not necessary at all for the code to work but it's |
| @@ -2606,12 +2632,10 @@ there for compatibility with CEDET.") | |||
| 2606 | 2632 | ||
| 2607 | (defun python-shell-internal-get-or-create-process () | 2633 | (defun python-shell-internal-get-or-create-process () |
| 2608 | "Get or create an inferior Internal Python process." | 2634 | "Get or create an inferior Internal Python process." |
| 2609 | (let* ((proc-name (python-shell-internal-get-process-name)) | 2635 | (let ((proc-name (python-shell-internal-get-process-name))) |
| 2610 | (proc-buffer-name (format " *%s*" proc-name))) | 2636 | (if (process-live-p proc-name) |
| 2611 | (when (not (process-live-p proc-name)) | 2637 | (get-process proc-name) |
| 2612 | (run-python-internal) | 2638 | (run-python-internal)))) |
| 2613 | (setq python-shell-internal-buffer proc-buffer-name)) | ||
| 2614 | (get-buffer-process proc-buffer-name))) | ||
| 2615 | 2639 | ||
| 2616 | (define-obsolete-function-alias | 2640 | (define-obsolete-function-alias |
| 2617 | 'python-proc 'python-shell-internal-get-or-create-process "24.3") | 2641 | 'python-proc 'python-shell-internal-get-or-create-process "24.3") |
| @@ -2628,20 +2652,24 @@ there for compatibility with CEDET.") | |||
| 2628 | (concat (file-remote-p default-directory) "/tmp") | 2652 | (concat (file-remote-p default-directory) "/tmp") |
| 2629 | temporary-file-directory)) | 2653 | temporary-file-directory)) |
| 2630 | (temp-file-name (make-temp-file "py")) | 2654 | (temp-file-name (make-temp-file "py")) |
| 2631 | (coding-system-for-write 'utf-8)) | 2655 | (coding-system-for-write (python-info-encoding))) |
| 2632 | (with-temp-file temp-file-name | 2656 | (with-temp-file temp-file-name |
| 2633 | (insert "# -*- coding: utf-8 -*-\n") ;Not needed for Python-3. | ||
| 2634 | (insert string) | 2657 | (insert string) |
| 2635 | (delete-trailing-whitespace)) | 2658 | (delete-trailing-whitespace)) |
| 2636 | temp-file-name)) | 2659 | temp-file-name)) |
| 2637 | 2660 | ||
| 2638 | (defun python-shell-send-string (string &optional process) | 2661 | (defun python-shell-send-string (string &optional process msg) |
| 2639 | "Send STRING to inferior Python PROCESS." | 2662 | "Send STRING to inferior Python PROCESS. |
| 2640 | (interactive "sPython command: ") | 2663 | When optional argument MSG is non-nil, forces display of a |
| 2641 | (let ((process (or process (python-shell-get-or-create-process)))) | 2664 | user-friendly message if there's no process running; defaults to |
| 2665 | t when called interactively." | ||
| 2666 | (interactive | ||
| 2667 | (list (read-string "Python command: ") nil t)) | ||
| 2668 | (let ((process (or process (python-shell-get-process-or-error msg)))) | ||
| 2642 | (if (string-match ".\n+." string) ;Multiline. | 2669 | (if (string-match ".\n+." string) ;Multiline. |
| 2643 | (let* ((temp-file-name (python-shell--save-temp-file string))) | 2670 | (let* ((temp-file-name (python-shell--save-temp-file string)) |
| 2644 | (python-shell-send-file temp-file-name process temp-file-name t)) | 2671 | (file-name (or (buffer-file-name) temp-file-name))) |
| 2672 | (python-shell-send-file file-name process temp-file-name t)) | ||
| 2645 | (comint-send-string process string) | 2673 | (comint-send-string process string) |
| 2646 | (when (or (not (string-match "\n\\'" string)) | 2674 | (when (or (not (string-match "\n\\'" string)) |
| 2647 | (string-match "\n[ \t].*\n?\\'" string)) | 2675 | (string-match "\n[ \t].*\n?\\'" string)) |
| @@ -2680,7 +2708,7 @@ detecting a prompt at the end of the buffer." | |||
| 2680 | (defun python-shell-send-string-no-output (string &optional process) | 2708 | (defun python-shell-send-string-no-output (string &optional process) |
| 2681 | "Send STRING to PROCESS and inhibit output. | 2709 | "Send STRING to PROCESS and inhibit output. |
| 2682 | Return the output." | 2710 | Return the output." |
| 2683 | (let ((process (or process (python-shell-get-or-create-process))) | 2711 | (let ((process (or process (python-shell-get-process-or-error))) |
| 2684 | (comint-preoutput-filter-functions | 2712 | (comint-preoutput-filter-functions |
| 2685 | '(python-shell-output-filter)) | 2713 | '(python-shell-output-filter)) |
| 2686 | (python-shell-output-filter-in-progress t) | 2714 | (python-shell-output-filter-in-progress t) |
| @@ -2717,12 +2745,6 @@ Returns the output. See `python-shell-send-string-no-output'." | |||
| 2717 | (define-obsolete-function-alias | 2745 | (define-obsolete-function-alias |
| 2718 | 'python-send-string 'python-shell-internal-send-string "24.3") | 2746 | 'python-send-string 'python-shell-internal-send-string "24.3") |
| 2719 | 2747 | ||
| 2720 | (defvar python--use-fake-loc nil | ||
| 2721 | "If non-nil, use `compilation-fake-loc' to trace errors back to the buffer. | ||
| 2722 | If nil, regions of text are prepended by the corresponding number of empty | ||
| 2723 | lines and Python is told to output error messages referring to the whole | ||
| 2724 | source file.") | ||
| 2725 | |||
| 2726 | (defun python-shell-buffer-substring (start end &optional nomain) | 2748 | (defun python-shell-buffer-substring (start end &optional nomain) |
| 2727 | "Send buffer substring from START to END formatted for shell. | 2749 | "Send buffer substring from START to END formatted for shell. |
| 2728 | This is a wrapper over `buffer-substring' that takes care of | 2750 | This is a wrapper over `buffer-substring' that takes care of |
| @@ -2732,27 +2754,32 @@ the python shell: | |||
| 2732 | \"if __name__ == '__main__'\" block will be removed. | 2754 | \"if __name__ == '__main__'\" block will be removed. |
| 2733 | 2. When a subregion of the buffer is sent, it takes care of | 2755 | 2. When a subregion of the buffer is sent, it takes care of |
| 2734 | appending extra empty lines so tracebacks are correct. | 2756 | appending extra empty lines so tracebacks are correct. |
| 2735 | 3. Wraps indented regions under an \"if True:\" block so the | 2757 | 3. When the region sent is a substring of the current buffer, a |
| 2758 | coding cookie is added. | ||
| 2759 | 4. Wraps indented regions under an \"if True:\" block so the | ||
| 2736 | interpreter evaluates them correctly." | 2760 | interpreter evaluates them correctly." |
| 2737 | (let ((substring (buffer-substring-no-properties start end)) | 2761 | (let* ((substring (buffer-substring-no-properties start end)) |
| 2738 | (fillstr (unless python--use-fake-loc | 2762 | (starts-at-point-min-p (save-restriction |
| 2739 | (make-string (1- (line-number-at-pos start)) ?\n))) | 2763 | (widen) |
| 2740 | (toplevel-block-p (save-excursion | 2764 | (= (point-min) start))) |
| 2741 | (goto-char start) | 2765 | (encoding (python-info-encoding)) |
| 2742 | (or (zerop (line-number-at-pos start)) | 2766 | (fillstr (when (not starts-at-point-min-p) |
| 2743 | (progn | 2767 | (concat |
| 2744 | (python-util-forward-comment 1) | 2768 | (format "# -*- coding: %s -*-\n" encoding) |
| 2745 | (zerop (current-indentation))))))) | 2769 | (make-string |
| 2770 | ;; Substract 2 because of the coding cookie. | ||
| 2771 | (- (line-number-at-pos start) 2) ?\n)))) | ||
| 2772 | (toplevel-block-p (save-excursion | ||
| 2773 | (goto-char start) | ||
| 2774 | (or (zerop (line-number-at-pos start)) | ||
| 2775 | (progn | ||
| 2776 | (python-util-forward-comment 1) | ||
| 2777 | (zerop (current-indentation))))))) | ||
| 2746 | (with-temp-buffer | 2778 | (with-temp-buffer |
| 2747 | (python-mode) | 2779 | (python-mode) |
| 2748 | (if fillstr (insert fillstr)) | 2780 | (if fillstr (insert fillstr)) |
| 2749 | (insert substring) | 2781 | (insert substring) |
| 2750 | (goto-char (point-min)) | 2782 | (goto-char (point-min)) |
| 2751 | (unless python--use-fake-loc | ||
| 2752 | ;; python-shell--save-temp-file adds an extra coding line, which would | ||
| 2753 | ;; throw off the line-counts, so let's try to compensate here. | ||
| 2754 | (if (looking-at "[ \t]*[#\n]") | ||
| 2755 | (delete-region (point) (line-beginning-position 2)))) | ||
| 2756 | (when (not toplevel-block-p) | 2783 | (when (not toplevel-block-p) |
| 2757 | (insert "if True:") | 2784 | (insert "if True:") |
| 2758 | (delete-region (point) (line-end-position))) | 2785 | (delete-region (point) (line-end-position))) |
| @@ -2763,53 +2790,65 @@ the python shell: | |||
| 2763 | (when (python-nav-if-name-main) | 2790 | (when (python-nav-if-name-main) |
| 2764 | (cons (point) | 2791 | (cons (point) |
| 2765 | (progn (python-nav-forward-sexp-safe) | 2792 | (progn (python-nav-forward-sexp-safe) |
| 2793 | ;; Include ending newline | ||
| 2794 | (forward-line 1) | ||
| 2766 | (point))))))) | 2795 | (point))))))) |
| 2767 | ;; Oh destructuring bind, how I miss you. | 2796 | ;; Oh destructuring bind, how I miss you. |
| 2768 | (if-name-main-start (car if-name-main-start-end)) | 2797 | (if-name-main-start (car if-name-main-start-end)) |
| 2769 | (if-name-main-end (cdr if-name-main-start-end))) | 2798 | (if-name-main-end (cdr if-name-main-start-end)) |
| 2799 | (fillstr (make-string | ||
| 2800 | (- (line-number-at-pos if-name-main-end) | ||
| 2801 | (line-number-at-pos if-name-main-start)) ?\n))) | ||
| 2770 | (when if-name-main-start-end | 2802 | (when if-name-main-start-end |
| 2771 | (goto-char if-name-main-start) | 2803 | (goto-char if-name-main-start) |
| 2772 | (delete-region if-name-main-start if-name-main-end) | 2804 | (delete-region if-name-main-start if-name-main-end) |
| 2773 | (insert | 2805 | (insert fillstr)))) |
| 2774 | (make-string | 2806 | ;; Ensure there's only one coding cookie in the generated string. |
| 2775 | (- (line-number-at-pos if-name-main-end) | 2807 | (goto-char (point-min)) |
| 2776 | (line-number-at-pos if-name-main-start)) ?\n))))) | 2808 | (when (looking-at-p (python-rx coding-cookie)) |
| 2809 | (forward-line 1) | ||
| 2810 | (when (looking-at-p (python-rx coding-cookie)) | ||
| 2811 | (delete-region | ||
| 2812 | (line-beginning-position) (line-end-position)))) | ||
| 2777 | (buffer-substring-no-properties (point-min) (point-max))))) | 2813 | (buffer-substring-no-properties (point-min) (point-max))))) |
| 2778 | 2814 | ||
| 2779 | (declare-function compilation-fake-loc "compile" | 2815 | (defun python-shell-send-region (start end &optional send-main msg) |
| 2780 | (marker file &optional line col)) | 2816 | "Send the region delimited by START and END to inferior Python process. |
| 2781 | 2817 | When optional argument SEND-MAIN is non-nil, allow execution of | |
| 2782 | (defun python-shell-send-region (start end &optional nomain) | 2818 | code inside blocks delimited by \"if __name__== '__main__':\". |
| 2783 | "Send the region delimited by START and END to inferior Python process." | 2819 | When called interactively SEND-MAIN defaults to nil, unless it's |
| 2784 | (interactive "r") | 2820 | called with prefix argument. When optional argument MSG is |
| 2785 | (let* ((python--use-fake-loc | 2821 | non-nil, forces display of a user-friendly message if there's no |
| 2786 | (or python--use-fake-loc (not buffer-file-name))) | 2822 | process running; defaults to t when called interactively." |
| 2787 | (string (python-shell-buffer-substring start end nomain)) | 2823 | (interactive |
| 2788 | (process (python-shell-get-or-create-process)) | 2824 | (list (region-beginning) (region-end) current-prefix-arg t)) |
| 2789 | (_ (string-match "\\`\n*\\(.*\\)" string))) | 2825 | (let* ((string (python-shell-buffer-substring start end (not send-main))) |
| 2790 | (message "Sent: %s..." (match-string 1 string)) | 2826 | (process (python-shell-get-process-or-error msg)) |
| 2791 | (let* ((temp-file-name (python-shell--save-temp-file string)) | 2827 | (original-string (buffer-substring-no-properties start end)) |
| 2792 | (file-name (or (buffer-file-name) temp-file-name))) | 2828 | (_ (string-match "\\`\n*\\(.*\\)" original-string))) |
| 2793 | (python-shell-send-file file-name process temp-file-name t) | 2829 | (message "Sent: %s..." (match-string 1 original-string)) |
| 2794 | (unless python--use-fake-loc | 2830 | (python-shell-send-string string process))) |
| 2795 | (with-current-buffer (process-buffer process) | 2831 | |
| 2796 | (compilation-fake-loc (copy-marker start) temp-file-name | 2832 | (defun python-shell-send-buffer (&optional send-main msg) |
| 2797 | 2)) ;; Not 1, because of the added coding line. | ||
| 2798 | )))) | ||
| 2799 | |||
| 2800 | (defun python-shell-send-buffer (&optional arg) | ||
| 2801 | "Send the entire buffer to inferior Python process. | 2833 | "Send the entire buffer to inferior Python process. |
| 2802 | With prefix ARG allow execution of code inside blocks delimited | 2834 | When optional argument SEND-MAIN is non-nil, allow execution of |
| 2803 | by \"if __name__== '__main__':\"." | 2835 | code inside blocks delimited by \"if __name__== '__main__':\". |
| 2804 | (interactive "P") | 2836 | When called interactively SEND-MAIN defaults to nil, unless it's |
| 2837 | called with prefix argument. When optional argument MSG is | ||
| 2838 | non-nil, forces display of a user-friendly message if there's no | ||
| 2839 | process running; defaults to t when called interactively." | ||
| 2840 | (interactive (list current-prefix-arg t)) | ||
| 2805 | (save-restriction | 2841 | (save-restriction |
| 2806 | (widen) | 2842 | (widen) |
| 2807 | (python-shell-send-region (point-min) (point-max) (not arg)))) | 2843 | (python-shell-send-region (point-min) (point-max) send-main msg))) |
| 2808 | 2844 | ||
| 2809 | (defun python-shell-send-defun (arg) | 2845 | (defun python-shell-send-defun (&optional arg msg) |
| 2810 | "Send the current defun to inferior Python process. | 2846 | "Send the current defun to inferior Python process. |
| 2811 | When argument ARG is non-nil do not include decorators." | 2847 | When argument ARG is non-nil do not include decorators. When |
| 2812 | (interactive "P") | 2848 | optional argument MSG is non-nil, forces display of a |
| 2849 | user-friendly message if there's no process running; defaults to | ||
| 2850 | t when called interactively." | ||
| 2851 | (interactive (list current-prefix-arg t)) | ||
| 2813 | (save-excursion | 2852 | (save-excursion |
| 2814 | (python-shell-send-region | 2853 | (python-shell-send-region |
| 2815 | (progn | 2854 | (progn |
| @@ -2825,42 +2864,60 @@ When argument ARG is non-nil do not include decorators." | |||
| 2825 | (progn | 2864 | (progn |
| 2826 | (or (python-nav-end-of-defun) | 2865 | (or (python-nav-end-of-defun) |
| 2827 | (end-of-line 1)) | 2866 | (end-of-line 1)) |
| 2828 | (point-marker))))) | 2867 | (point-marker)) |
| 2868 | nil ;; noop | ||
| 2869 | msg))) | ||
| 2829 | 2870 | ||
| 2830 | (defun python-shell-send-file (file-name &optional process temp-file-name | 2871 | (defun python-shell-send-file (file-name &optional process temp-file-name |
| 2831 | delete) | 2872 | delete msg) |
| 2832 | "Send FILE-NAME to inferior Python PROCESS. | 2873 | "Send FILE-NAME to inferior Python PROCESS. |
| 2833 | If TEMP-FILE-NAME is passed then that file is used for processing | 2874 | If TEMP-FILE-NAME is passed then that file is used for processing |
| 2834 | instead, while internally the shell will continue to use FILE-NAME. | 2875 | instead, while internally the shell will continue to use |
| 2835 | If DELETE is non-nil, delete the file afterwards." | 2876 | FILE-NAME. If TEMP-FILE-NAME and DELETE are non-nil, then |
| 2836 | (interactive "fFile to send: ") | 2877 | TEMP-FILE-NAME is deleted after evaluation is performed. When |
| 2837 | (let* ((process (or process (python-shell-get-or-create-process))) | 2878 | optional argument MSG is non-nil, forces display of a |
| 2879 | user-friendly message if there's no process running; defaults to | ||
| 2880 | t when called interactively." | ||
| 2881 | (interactive | ||
| 2882 | (list | ||
| 2883 | (read-file-name "File to send: ") ; file-name | ||
| 2884 | nil ; process | ||
| 2885 | nil ; temp-file-name | ||
| 2886 | nil ; delete | ||
| 2887 | t)) ; msg | ||
| 2888 | (let* ((process (or process (python-shell-get-process-or-error msg))) | ||
| 2889 | (encoding (with-temp-buffer | ||
| 2890 | (insert-file-contents | ||
| 2891 | (or temp-file-name file-name)) | ||
| 2892 | (python-info-encoding))) | ||
| 2893 | (file-name (expand-file-name | ||
| 2894 | (or (file-remote-p file-name 'localname) | ||
| 2895 | file-name))) | ||
| 2838 | (temp-file-name (when temp-file-name | 2896 | (temp-file-name (when temp-file-name |
| 2839 | (expand-file-name | 2897 | (expand-file-name |
| 2840 | (or (file-remote-p temp-file-name 'localname) | 2898 | (or (file-remote-p temp-file-name 'localname) |
| 2841 | temp-file-name)))) | 2899 | temp-file-name))))) |
| 2842 | (file-name (or (when file-name | ||
| 2843 | (expand-file-name | ||
| 2844 | (or (file-remote-p file-name 'localname) | ||
| 2845 | file-name))) | ||
| 2846 | temp-file-name))) | ||
| 2847 | (when (not file-name) | ||
| 2848 | (error "If FILE-NAME is nil then TEMP-FILE-NAME must be non-nil")) | ||
| 2849 | (python-shell-send-string | 2900 | (python-shell-send-string |
| 2850 | (format | 2901 | (format |
| 2851 | (concat "__pyfile = open('''%s''');" | 2902 | (concat |
| 2852 | "exec(compile(__pyfile.read(), '''%s''', 'exec'));" | 2903 | "import codecs, os;" |
| 2853 | "__pyfile.close()%s") | 2904 | "__pyfile = codecs.open('''%s''', encoding='''%s''');" |
| 2854 | (or temp-file-name file-name) file-name | 2905 | "__code = __pyfile.read().encode('''%s''');" |
| 2855 | (if delete (format "; import os; os.remove('''%s''')" | 2906 | "__pyfile.close();" |
| 2856 | (or temp-file-name file-name)) | 2907 | (when (and delete temp-file-name) |
| 2857 | "")) | 2908 | (format "os.remove('''%s''');" temp-file-name)) |
| 2909 | "exec(compile(__code, '''%s''', 'exec'));") | ||
| 2910 | (or temp-file-name file-name) encoding encoding file-name) | ||
| 2858 | process))) | 2911 | process))) |
| 2859 | 2912 | ||
| 2860 | (defun python-shell-switch-to-shell () | 2913 | (defun python-shell-switch-to-shell (&optional msg) |
| 2861 | "Switch to inferior Python process buffer." | 2914 | "Switch to inferior Python process buffer. |
| 2862 | (interactive) | 2915 | When optional argument MSG is non-nil, forces display of a |
| 2863 | (process-buffer (python-shell-get-or-create-process)) t) | 2916 | user-friendly message if there's no process running; defaults to |
| 2917 | t when called interactively." | ||
| 2918 | (interactive "p") | ||
| 2919 | (pop-to-buffer | ||
| 2920 | (process-buffer (python-shell-get-process-or-error msg)) nil t)) | ||
| 2864 | 2921 | ||
| 2865 | (defun python-shell-send-setup-code () | 2922 | (defun python-shell-send-setup-code () |
| 2866 | "Send all setup code for shell. | 2923 | "Send all setup code for shell. |
| @@ -2947,6 +3004,194 @@ the full statement in the case of imports." | |||
| 2947 | "25.1" | 3004 | "25.1" |
| 2948 | "Completion string code must work for (i)pdb.") | 3005 | "Completion string code must work for (i)pdb.") |
| 2949 | 3006 | ||
| 3007 | (defcustom python-shell-completion-native-disabled-interpreters | ||
| 3008 | ;; PyPy's readline cannot handle some escape sequences yet. | ||
| 3009 | (list "pypy") | ||
| 3010 | "List of disabled interpreters. | ||
| 3011 | When a match is found, native completion is disabled." | ||
| 3012 | :type '(repeat string)) | ||
| 3013 | |||
| 3014 | (defcustom python-shell-completion-native-enable t | ||
| 3015 | "Enable readline based native completion." | ||
| 3016 | :type 'boolean) | ||
| 3017 | |||
| 3018 | (defcustom python-shell-completion-native-output-timeout 0.01 | ||
| 3019 | "Time in seconds to wait for completion output before giving up." | ||
| 3020 | :type 'float) | ||
| 3021 | |||
| 3022 | (defvar python-shell-completion-native-redirect-buffer | ||
| 3023 | " *Python completions redirect*" | ||
| 3024 | "Buffer to be used to redirect output of readline commands.") | ||
| 3025 | |||
| 3026 | (defun python-shell-completion-native-interpreter-disabled-p () | ||
| 3027 | "Return non-nil if interpreter has native completion disabled." | ||
| 3028 | (when python-shell-completion-native-disabled-interpreters | ||
| 3029 | (string-match | ||
| 3030 | (regexp-opt python-shell-completion-native-disabled-interpreters) | ||
| 3031 | (file-name-nondirectory python-shell-interpreter)))) | ||
| 3032 | |||
| 3033 | (defun python-shell-completion-native-try () | ||
| 3034 | "Return non-nil if can trigger native completion." | ||
| 3035 | (let ((python-shell-completion-native-enable t)) | ||
| 3036 | (python-shell-completion-native-get-completions | ||
| 3037 | (get-buffer-process (current-buffer)) | ||
| 3038 | nil "int"))) | ||
| 3039 | |||
| 3040 | (defun python-shell-completion-native-setup () | ||
| 3041 | "Try to setup native completion, return non-nil on success." | ||
| 3042 | (let ((process (python-shell-get-process))) | ||
| 3043 | (python-shell-send-string | ||
| 3044 | (funcall | ||
| 3045 | 'mapconcat | ||
| 3046 | #'identity | ||
| 3047 | (list | ||
| 3048 | "try:" | ||
| 3049 | " import readline, rlcompleter" | ||
| 3050 | ;; Remove parens on callables as it breaks completion on | ||
| 3051 | ;; arguments (e.g. str(Ari<tab>)). | ||
| 3052 | " class Completer(rlcompleter.Completer):" | ||
| 3053 | " def _callable_postfix(self, val, word):" | ||
| 3054 | " return word" | ||
| 3055 | " readline.set_completer(Completer().complete)" | ||
| 3056 | " if readline.__doc__ and 'libedit' in readline.__doc__:" | ||
| 3057 | " readline.parse_and_bind('bind ^I rl_complete')" | ||
| 3058 | " else:" | ||
| 3059 | " readline.parse_and_bind('tab: complete')" | ||
| 3060 | " print ('python.el: readline is available')" | ||
| 3061 | "except:" | ||
| 3062 | " print ('python.el: readline not available')") | ||
| 3063 | "\n") | ||
| 3064 | process) | ||
| 3065 | (python-shell-accept-process-output process) | ||
| 3066 | (when (save-excursion | ||
| 3067 | (re-search-backward | ||
| 3068 | (regexp-quote "python.el: readline is available") nil t 1)) | ||
| 3069 | (python-shell-completion-native-try)))) | ||
| 3070 | |||
| 3071 | (defun python-shell-completion-native-turn-off (&optional msg) | ||
| 3072 | "Turn off shell native completions. | ||
| 3073 | With argument MSG show deactivation message." | ||
| 3074 | (interactive "p") | ||
| 3075 | (python-shell-with-shell-buffer | ||
| 3076 | (set (make-local-variable 'python-shell-completion-native-enable) nil) | ||
| 3077 | (when msg | ||
| 3078 | (message "Shell native completion is disabled, using fallback")))) | ||
| 3079 | |||
| 3080 | (defun python-shell-completion-native-turn-on (&optional msg) | ||
| 3081 | "Turn on shell native completions. | ||
| 3082 | With argument MSG show deactivation message." | ||
| 3083 | (interactive "p") | ||
| 3084 | (python-shell-with-shell-buffer | ||
| 3085 | (set (make-local-variable 'python-shell-completion-native-enable) t) | ||
| 3086 | (python-shell-completion-native-turn-on-maybe msg))) | ||
| 3087 | |||
| 3088 | (defun python-shell-completion-native-turn-on-maybe (&optional msg) | ||
| 3089 | "Turn on native completions if enabled and available. | ||
| 3090 | With argument MSG show activation/deactivation message." | ||
| 3091 | (interactive "p") | ||
| 3092 | (python-shell-with-shell-buffer | ||
| 3093 | (when python-shell-completion-native-enable | ||
| 3094 | (cond | ||
| 3095 | ((python-shell-completion-native-interpreter-disabled-p) | ||
| 3096 | (python-shell-completion-native-turn-off msg)) | ||
| 3097 | ((python-shell-completion-native-setup) | ||
| 3098 | (when msg | ||
| 3099 | (message "Shell native completion is enabled."))) | ||
| 3100 | (t (lwarn | ||
| 3101 | '(python python-shell-completion-native-turn-on-maybe) | ||
| 3102 | :warning | ||
| 3103 | (concat | ||
| 3104 | "Your `python-shell-interpreter' doesn't seem to " | ||
| 3105 | "support readline, yet `python-shell-completion-native' " | ||
| 3106 | (format "was `t' and %S is not part of the " | ||
| 3107 | (file-name-nondirectory python-shell-interpreter)) | ||
| 3108 | "`python-shell-completion-native-disabled-interpreters' " | ||
| 3109 | "list. Native completions have been disabled locally. ")) | ||
| 3110 | (python-shell-completion-native-turn-off msg)))))) | ||
| 3111 | |||
| 3112 | (defun python-shell-completion-native-turn-on-maybe-with-msg () | ||
| 3113 | "Like `python-shell-completion-native-turn-on-maybe' but force messages." | ||
| 3114 | (python-shell-completion-native-turn-on-maybe t)) | ||
| 3115 | |||
| 3116 | (add-hook 'inferior-python-mode-hook | ||
| 3117 | #'python-shell-completion-native-turn-on-maybe-with-msg) | ||
| 3118 | |||
| 3119 | (defun python-shell-completion-native-toggle (&optional msg) | ||
| 3120 | "Toggle shell native completion. | ||
| 3121 | With argument MSG show activation/deactivation message." | ||
| 3122 | (interactive "p") | ||
| 3123 | (python-shell-with-shell-buffer | ||
| 3124 | (if python-shell-completion-native-enable | ||
| 3125 | (python-shell-completion-native-turn-off msg) | ||
| 3126 | (python-shell-completion-native-turn-on msg)) | ||
| 3127 | python-shell-completion-native-enable)) | ||
| 3128 | |||
| 3129 | (defun python-shell-completion-native-get-completions (process import input) | ||
| 3130 | "Get completions using native readline for PROCESS. | ||
| 3131 | When IMPORT is non-nil takes precedence over INPUT for | ||
| 3132 | completion." | ||
| 3133 | (when (and python-shell-completion-native-enable | ||
| 3134 | (python-util-comint-last-prompt) | ||
| 3135 | (>= (point) (cdr (python-util-comint-last-prompt)))) | ||
| 3136 | (let* ((input (or import input)) | ||
| 3137 | (original-filter-fn (process-filter process)) | ||
| 3138 | (redirect-buffer (get-buffer-create | ||
| 3139 | python-shell-completion-native-redirect-buffer)) | ||
| 3140 | (separators (python-rx | ||
| 3141 | (or whitespace open-paren close-paren))) | ||
| 3142 | (trigger "\t\t\t") | ||
| 3143 | (new-input (concat input trigger)) | ||
| 3144 | (input-length | ||
| 3145 | (save-excursion | ||
| 3146 | (+ (- (point-max) (comint-bol)) (length new-input)))) | ||
| 3147 | (delete-line-command (make-string input-length ?\b)) | ||
| 3148 | (input-to-send (concat new-input delete-line-command))) | ||
| 3149 | ;; Ensure restoring the process filter, even if the user quits | ||
| 3150 | ;; or there's some other error. | ||
| 3151 | (unwind-protect | ||
| 3152 | (with-current-buffer redirect-buffer | ||
| 3153 | ;; Cleanup the redirect buffer | ||
| 3154 | (delete-region (point-min) (point-max)) | ||
| 3155 | ;; Mimic `comint-redirect-send-command', unfortunately it | ||
| 3156 | ;; can't be used here because it expects a newline in the | ||
| 3157 | ;; command and that's exactly what we are trying to avoid. | ||
| 3158 | (let ((comint-redirect-echo-input nil) | ||
| 3159 | (comint-redirect-verbose nil) | ||
| 3160 | (comint-redirect-perform-sanity-check nil) | ||
| 3161 | (comint-redirect-insert-matching-regexp nil) | ||
| 3162 | ;; Feed it some regex that will never match. | ||
| 3163 | (comint-redirect-finished-regexp "^\\'$") | ||
| 3164 | (comint-redirect-output-buffer redirect-buffer)) | ||
| 3165 | ;; Compatibility with Emacs 24.x. Comint changed and | ||
| 3166 | ;; now `comint-redirect-filter' gets 3 args. This | ||
| 3167 | ;; checks which version of `comint-redirect-filter' is | ||
| 3168 | ;; in use based on its args and uses `apply-partially' | ||
| 3169 | ;; to make it up for the 3 args case. | ||
| 3170 | (if (= (length | ||
| 3171 | (help-function-arglist 'comint-redirect-filter)) 3) | ||
| 3172 | (set-process-filter | ||
| 3173 | process (apply-partially | ||
| 3174 | #'comint-redirect-filter original-filter-fn)) | ||
| 3175 | (set-process-filter process #'comint-redirect-filter)) | ||
| 3176 | (process-send-string process input-to-send) | ||
| 3177 | (accept-process-output | ||
| 3178 | process | ||
| 3179 | python-shell-completion-native-output-timeout) | ||
| 3180 | ;; XXX: can't use `python-shell-accept-process-output' | ||
| 3181 | ;; here because there are no guarantees on how output | ||
| 3182 | ;; ends. The workaround here is to call | ||
| 3183 | ;; `accept-process-output' until we don't find anything | ||
| 3184 | ;; else to accept. | ||
| 3185 | (while (accept-process-output | ||
| 3186 | process | ||
| 3187 | python-shell-completion-native-output-timeout)) | ||
| 3188 | (cl-remove-duplicates | ||
| 3189 | (split-string | ||
| 3190 | (buffer-substring-no-properties | ||
| 3191 | (point-min) (point-max)) | ||
| 3192 | separators t)))) | ||
| 3193 | (set-process-filter process original-filter-fn))))) | ||
| 3194 | |||
| 2950 | (defun python-shell-completion-get-completions (process import input) | 3195 | (defun python-shell-completion-get-completions (process import input) |
| 2951 | "Do completion at point using PROCESS for IMPORT or INPUT. | 3196 | "Do completion at point using PROCESS for IMPORT or INPUT. |
| 2952 | When IMPORT is non-nil takes precedence over INPUT for | 3197 | When IMPORT is non-nil takes precedence over INPUT for |
| @@ -3004,11 +3249,15 @@ using that one instead of current buffer's process." | |||
| 3004 | last-prompt-end | 3249 | last-prompt-end |
| 3005 | (forward-char (length (match-string-no-properties 0))) | 3250 | (forward-char (length (match-string-no-properties 0))) |
| 3006 | (point)))) | 3251 | (point)))) |
| 3007 | (end (point))) | 3252 | (end (point)) |
| 3253 | (completion-fn | ||
| 3254 | (if python-shell-completion-native-enable | ||
| 3255 | #'python-shell-completion-native-get-completions | ||
| 3256 | #'python-shell-completion-get-completions))) | ||
| 3008 | (list start end | 3257 | (list start end |
| 3009 | (completion-table-dynamic | 3258 | (completion-table-dynamic |
| 3010 | (apply-partially | 3259 | (apply-partially |
| 3011 | #'python-shell-completion-get-completions | 3260 | completion-fn |
| 3012 | process import-statement))))) | 3261 | process import-statement))))) |
| 3013 | 3262 | ||
| 3014 | (define-obsolete-function-alias | 3263 | (define-obsolete-function-alias |
| @@ -4155,6 +4404,32 @@ operator." | |||
| 4155 | (* whitespace) line-end)) | 4404 | (* whitespace) line-end)) |
| 4156 | (string-equal "" (match-string-no-properties 1)))) | 4405 | (string-equal "" (match-string-no-properties 1)))) |
| 4157 | 4406 | ||
| 4407 | (defun python-info-encoding-from-cookie () | ||
| 4408 | "Detect current buffer's encoding from its coding cookie. | ||
| 4409 | Returns the enconding as a symbol." | ||
| 4410 | (let ((first-two-lines | ||
| 4411 | (save-excursion | ||
| 4412 | (save-restriction | ||
| 4413 | (widen) | ||
| 4414 | (goto-char (point-min)) | ||
| 4415 | (forward-line 2) | ||
| 4416 | (buffer-substring-no-properties | ||
| 4417 | (point) | ||
| 4418 | (point-min)))))) | ||
| 4419 | (when (string-match (python-rx coding-cookie) first-two-lines) | ||
| 4420 | (intern (match-string-no-properties 1 first-two-lines))))) | ||
| 4421 | |||
| 4422 | (defun python-info-encoding () | ||
| 4423 | "Return encoding for file. | ||
| 4424 | Try `python-info-encoding-from-cookie', if none is found then | ||
| 4425 | default to utf-8." | ||
| 4426 | ;; If no enconding is defined, then it's safe to use UTF-8: Python 2 | ||
| 4427 | ;; uses ASCII as default while Python 3 uses UTF-8. This means that | ||
| 4428 | ;; in the worst case escenario python.el will make things work for | ||
| 4429 | ;; Python 2 files with unicode data and no encoding defined. | ||
| 4430 | (or (python-info-encoding-from-cookie) | ||
| 4431 | 'utf-8)) | ||
| 4432 | |||
| 4158 | 4433 | ||
| 4159 | ;;; Utility functions | 4434 | ;;; Utility functions |
| 4160 | 4435 | ||
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 524749d6266..904e9dfc289 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -2374,7 +2374,7 @@ Calls the value of `sh-set-shell-hook' if set." | |||
| 2374 | (sh-make-vars-local)) | 2374 | (sh-make-vars-local)) |
| 2375 | (message "Indentation setup for shell type %s" sh-shell)) | 2375 | (message "Indentation setup for shell type %s" sh-shell)) |
| 2376 | (message "No indentation for this shell type.") | 2376 | (message "No indentation for this shell type.") |
| 2377 | (setq indent-line-function 'sh-basic-indent-line)) | 2377 | (setq-local indent-line-function 'sh-basic-indent-line)) |
| 2378 | (when font-lock-mode | 2378 | (when font-lock-mode |
| 2379 | (setq font-lock-set-defaults nil) | 2379 | (setq font-lock-set-defaults nil) |
| 2380 | (font-lock-set-defaults) | 2380 | (font-lock-set-defaults) |
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 21c0d6aa6a4..f3dc4bd4cfd 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el | |||
| @@ -136,6 +136,31 @@ actual location is not known.") | |||
| 136 | 136 | ||
| 137 | (defmethod xref-location-group ((_ xref-bogus-location)) "(No location)") | 137 | (defmethod xref-location-group ((_ xref-bogus-location)) "(No location)") |
| 138 | 138 | ||
| 139 | ;; This should be in elisp-mode.el, but it's preloaded, and we can't | ||
| 140 | ;; preload defclass and defmethod (at least, not yet). | ||
| 141 | (defclass xref-elisp-location (xref-location) | ||
| 142 | ((symbol :type symbol :initarg :symbol) | ||
| 143 | (type :type symbol :initarg :type) | ||
| 144 | (file :type string :initarg :file | ||
| 145 | :reader xref-location-group)) | ||
| 146 | :documentation "Location of an Emacs Lisp symbol definition.") | ||
| 147 | |||
| 148 | (defun xref-make-elisp-location (symbol type file) | ||
| 149 | (make-instance 'xref-elisp-location :symbol symbol :type type :file file)) | ||
| 150 | |||
| 151 | (defmethod xref-location-marker ((l xref-elisp-location)) | ||
| 152 | (with-slots (symbol type file) l | ||
| 153 | (let ((buffer-point | ||
| 154 | (pcase type | ||
| 155 | (`defun (find-function-search-for-symbol symbol nil file)) | ||
| 156 | ((or `defvar `defface) | ||
| 157 | (find-function-search-for-symbol symbol type file)) | ||
| 158 | (`feature | ||
| 159 | (cons (find-file-noselect file) 1))))) | ||
| 160 | (with-current-buffer (car buffer-point) | ||
| 161 | (goto-char (or (cdr buffer-point) (point-min))) | ||
| 162 | (point-marker))))) | ||
| 163 | |||
| 139 | 164 | ||
| 140 | ;;; Cross-reference | 165 | ;;; Cross-reference |
| 141 | 166 | ||
| @@ -442,7 +467,8 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)." | |||
| 442 | ;;;###autoload | 467 | ;;;###autoload |
| 443 | (defun xref-find-definitions (identifier) | 468 | (defun xref-find-definitions (identifier) |
| 444 | "Find the definition of the identifier at point. | 469 | "Find the definition of the identifier at point. |
| 445 | With prefix argument, prompt for the identifier." | 470 | With prefix argument or when there's no identifier at point, |
| 471 | prompt for it." | ||
| 446 | (interactive (list (xref--read-identifier "Find definitions of: "))) | 472 | (interactive (list (xref--read-identifier "Find definitions of: "))) |
| 447 | (xref--find-definitions identifier nil)) | 473 | (xref--find-definitions identifier nil)) |
| 448 | 474 | ||
diff --git a/lisp/saveplace.el b/lisp/saveplace.el index a25dba2e39e..985a52a0fc0 100644 --- a/lisp/saveplace.el +++ b/lisp/saveplace.el | |||
| @@ -138,6 +138,8 @@ disabled, i.e., the position is recorded for all files." | |||
| 138 | :version "24.1" | 138 | :version "24.1" |
| 139 | :type 'regexp :group 'save-place) | 139 | :type 'regexp :group 'save-place) |
| 140 | 140 | ||
| 141 | (declare-function dired-current-directory "dired" (&optional localp)) | ||
| 142 | |||
| 141 | (defun toggle-save-place (&optional parg) | 143 | (defun toggle-save-place (&optional parg) |
| 142 | "Toggle whether to save your place in this file between sessions. | 144 | "Toggle whether to save your place in this file between sessions. |
| 143 | If this mode is enabled, point is recorded when you kill the buffer | 145 | If this mode is enabled, point is recorded when you kill the buffer |
| @@ -153,7 +155,7 @@ file: | |||
| 153 | \(setq-default save-place t)" | 155 | \(setq-default save-place t)" |
| 154 | (interactive "P") | 156 | (interactive "P") |
| 155 | (if (not (or buffer-file-name (and (derived-mode-p 'dired-mode) | 157 | (if (not (or buffer-file-name (and (derived-mode-p 'dired-mode) |
| 156 | dired-directory))) | 158 | (dired-current-directory)))) |
| 157 | (message "Buffer `%s' not visiting a file or directory" (buffer-name)) | 159 | (message "Buffer `%s' not visiting a file or directory" (buffer-name)) |
| 158 | (setq save-place (if parg | 160 | (setq save-place (if parg |
| 159 | (> (prefix-numeric-value parg) 0) | 161 | (> (prefix-numeric-value parg) 0) |
| @@ -172,12 +174,13 @@ file: | |||
| 172 | ;; file. If not, do so, then feel free to modify the alist. It | 174 | ;; file. If not, do so, then feel free to modify the alist. It |
| 173 | ;; will be saved again when Emacs is killed. | 175 | ;; will be saved again when Emacs is killed. |
| 174 | (or save-place-loaded (load-save-place-alist-from-file)) | 176 | (or save-place-loaded (load-save-place-alist-from-file)) |
| 175 | (let ((item (or buffer-file-name | 177 | (let* ((directory (and (derived-mode-p 'dired-mode) |
| 176 | (and (derived-mode-p 'dired-mode) | 178 | (dired-current-directory))) |
| 177 | dired-directory | 179 | (item (or buffer-file-name |
| 178 | (expand-file-name (if (consp dired-directory) | 180 | (and directory |
| 179 | (car dired-directory) | 181 | (expand-file-name (if (consp directory) |
| 180 | dired-directory)))))) | 182 | (car directory) |
| 183 | directory)))))) | ||
| 181 | (when (and item | 184 | (when (and item |
| 182 | (or (not save-place-ignore-files-regexp) | 185 | (or (not save-place-ignore-files-regexp) |
| 183 | (not (string-match save-place-ignore-files-regexp | 186 | (not (string-match save-place-ignore-files-regexp |
| @@ -186,8 +189,7 @@ file: | |||
| 186 | (position (cond ((eq major-mode 'hexl-mode) | 189 | (position (cond ((eq major-mode 'hexl-mode) |
| 187 | (with-no-warnings | 190 | (with-no-warnings |
| 188 | (1+ (hexl-current-address)))) | 191 | (1+ (hexl-current-address)))) |
| 189 | ((and (derived-mode-p 'dired-mode) | 192 | ((and (derived-mode-p 'dired-mode) directory) |
| 190 | dired-directory) | ||
| 191 | (let ((filename (dired-get-filename nil t))) | 193 | (let ((filename (dired-get-filename nil t))) |
| 192 | (if filename | 194 | (if filename |
| 193 | `((dired-filename . ,filename)) | 195 | `((dired-filename . ,filename)) |
| @@ -305,7 +307,7 @@ may have changed) back to `save-place-alist'." | |||
| 305 | ;; save-place checks buffer-file-name too, but we can avoid | 307 | ;; save-place checks buffer-file-name too, but we can avoid |
| 306 | ;; overhead of function call by checking here too. | 308 | ;; overhead of function call by checking here too. |
| 307 | (and (or buffer-file-name (and (derived-mode-p 'dired-mode) | 309 | (and (or buffer-file-name (and (derived-mode-p 'dired-mode) |
| 308 | dired-directory)) | 310 | (dired-current-directory))) |
| 309 | (save-place-to-alist)) | 311 | (save-place-to-alist)) |
| 310 | (setq buf-list (cdr buf-list)))))) | 312 | (setq buf-list (cdr buf-list)))))) |
| 311 | 313 | ||
| @@ -325,19 +327,21 @@ may have changed) back to `save-place-alist'." | |||
| 325 | (defun save-place-dired-hook () | 327 | (defun save-place-dired-hook () |
| 326 | "Position the point in a Dired buffer." | 328 | "Position the point in a Dired buffer." |
| 327 | (or save-place-loaded (load-save-place-alist-from-file)) | 329 | (or save-place-loaded (load-save-place-alist-from-file)) |
| 328 | (let ((cell (assoc (and (derived-mode-p 'dired-mode) | 330 | (let* ((directory (and (derived-mode-p 'dired-mode) |
| 329 | dired-directory | 331 | (dired-current-directory))) |
| 330 | (expand-file-name (if (consp dired-directory) | 332 | (cell (assoc (and directory |
| 331 | (car dired-directory) | 333 | (expand-file-name (if (consp directory) |
| 332 | dired-directory))) | 334 | (car directory) |
| 333 | save-place-alist))) | 335 | directory))) |
| 336 | save-place-alist))) | ||
| 334 | (if cell | 337 | (if cell |
| 335 | (progn | 338 | (progn |
| 336 | (or revert-buffer-in-progress-p | 339 | (or revert-buffer-in-progress-p |
| 337 | (if (integerp (cdr cell)) | 340 | (cond |
| 338 | (goto-char (cdr cell)) | 341 | ((integerp (cdr cell)) |
| 339 | (and (assq 'dired-filename (cdr cell)) | 342 | (goto-char (cdr cell))) |
| 340 | (dired-goto-file (cdr (assq 'dired-filename (cdr cell))))))) | 343 | ((and (listp (cdr cell)) (assq 'dired-filename (cdr cell))) |
| 344 | (dired-goto-file (cdr (assq 'dired-filename (cdr cell))))))) | ||
| 341 | ;; and make sure it will be saved again for later | 345 | ;; and make sure it will be saved again for later |
| 342 | (setq save-place t))))) | 346 | (setq save-place t))))) |
| 343 | 347 | ||
diff --git a/lisp/simple.el b/lisp/simple.el index 0fcd5db45d9..b436dd7699f 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -1667,7 +1667,6 @@ invoking, give a prefix argument to `execute-extended-command'." | |||
| 1667 | (let ((prefix-arg prefixarg)) | 1667 | (let ((prefix-arg prefixarg)) |
| 1668 | (command-execute function 'record)) | 1668 | (command-execute function 'record)) |
| 1669 | ;; If enabled, show which key runs this command. | 1669 | ;; If enabled, show which key runs this command. |
| 1670 | ;; (when binding | ||
| 1671 | ;; But first wait, and skip the message if there is input. | 1670 | ;; But first wait, and skip the message if there is input. |
| 1672 | (let* ((waited | 1671 | (let* ((waited |
| 1673 | ;; If this command displayed something in the echo area; | 1672 | ;; If this command displayed something in the echo area; |
| @@ -1675,10 +1674,11 @@ invoking, give a prefix argument to `execute-extended-command'." | |||
| 1675 | ;; FIXME: Wait *after* running post-command-hook! | 1674 | ;; FIXME: Wait *after* running post-command-hook! |
| 1676 | ;; FIXME: Don't wait if execute-extended-command--shorter won't | 1675 | ;; FIXME: Don't wait if execute-extended-command--shorter won't |
| 1677 | ;; find a better answer anyway! | 1676 | ;; find a better answer anyway! |
| 1678 | (sit-for (cond | 1677 | (when suggest-key-bindings |
| 1679 | ((zerop (length (current-message))) 0) | 1678 | (sit-for (cond |
| 1680 | ((numberp suggest-key-bindings) suggest-key-bindings) | 1679 | ((zerop (length (current-message))) 0) |
| 1681 | (t 2))))) | 1680 | ((numberp suggest-key-bindings) suggest-key-bindings) |
| 1681 | (t 2)))))) | ||
| 1682 | (when (and waited (not (consp unread-command-events))) | 1682 | (when (and waited (not (consp unread-command-events))) |
| 1683 | (unless (or binding executing-kbd-macro (not (symbolp function)) | 1683 | (unless (or binding executing-kbd-macro (not (symbolp function)) |
| 1684 | (<= (length (symbol-name function)) 2)) | 1684 | (<= (length (symbol-name function)) 2)) |
diff --git a/lisp/startup.el b/lisp/startup.el index 8e981bbc64a..0c5e66a2e6e 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -358,6 +358,8 @@ this variable usefully is to set it while building and dumping Emacs." | |||
| 358 | :set (lambda (_variable _value) | 358 | :set (lambda (_variable _value) |
| 359 | (error "Customizing `site-run-file' does not work"))) | 359 | (error "Customizing `site-run-file' does not work"))) |
| 360 | 360 | ||
| 361 | (make-obsolete-variable 'system-name "use (system-name) instead" "25.1") | ||
| 362 | |||
| 361 | (defcustom mail-host-address nil | 363 | (defcustom mail-host-address nil |
| 362 | "Name of this machine, for purposes of naming users. | 364 | "Name of this machine, for purposes of naming users. |
| 363 | If non-nil, Emacs uses this instead of `system-name' when constructing | 365 | If non-nil, Emacs uses this instead of `system-name' when constructing |
diff --git a/lisp/subr.el b/lisp/subr.el index 6ce02b79a0a..53ad2729a10 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -2166,7 +2166,7 @@ keyboard-quit events while waiting for a valid input." | |||
| 2166 | char)) | 2166 | char)) |
| 2167 | 2167 | ||
| 2168 | (defun sit-for (seconds &optional nodisp obsolete) | 2168 | (defun sit-for (seconds &optional nodisp obsolete) |
| 2169 | "Perform redisplay, then wait for SECONDS seconds or until input is available. | 2169 | "Redisplay, then wait for SECONDS seconds. Stop when input is available. |
| 2170 | SECONDS may be a floating-point value. | 2170 | SECONDS may be a floating-point value. |
| 2171 | \(On operating systems that do not support waiting for fractions of a | 2171 | \(On operating systems that do not support waiting for fractions of a |
| 2172 | second, floating-point values are rounded down to the nearest integer.) | 2172 | second, floating-point values are rounded down to the nearest integer.) |
| @@ -2184,7 +2184,7 @@ floating point support." | |||
| 2184 | (declare (advertised-calling-convention (seconds &optional nodisp) "22.1")) | 2184 | (declare (advertised-calling-convention (seconds &optional nodisp) "22.1")) |
| 2185 | ;; This used to be implemented in C until the following discussion: | 2185 | ;; This used to be implemented in C until the following discussion: |
| 2186 | ;; http://lists.gnu.org/archive/html/emacs-devel/2006-07/msg00401.html | 2186 | ;; http://lists.gnu.org/archive/html/emacs-devel/2006-07/msg00401.html |
| 2187 | ;; Then it was moved to C using an implementation based on an idle timer, | 2187 | ;; Then it was moved here using an implementation based on an idle timer, |
| 2188 | ;; which was then replaced by the use of read-event. | 2188 | ;; which was then replaced by the use of read-event. |
| 2189 | (if (numberp nodisp) | 2189 | (if (numberp nodisp) |
| 2190 | (setq seconds (+ seconds (* 1e-3 nodisp)) | 2190 | (setq seconds (+ seconds (* 1e-3 nodisp)) |
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 1993ff104f4..12e7fda0f2c 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el | |||
| @@ -1300,18 +1300,48 @@ Inserts the value of `tex-open-quote' (normally ``) or `tex-close-quote' | |||
| 1300 | \(normally '') depending on the context. With prefix argument, always | 1300 | \(normally '') depending on the context. With prefix argument, always |
| 1301 | inserts \" characters." | 1301 | inserts \" characters." |
| 1302 | (interactive "*P") | 1302 | (interactive "*P") |
| 1303 | ;; Discover if we'll be inserting normal double quotes. | ||
| 1304 | ;; | ||
| 1303 | (if (or arg (memq (char-syntax (preceding-char)) '(?/ ?\\)) | 1305 | (if (or arg (memq (char-syntax (preceding-char)) '(?/ ?\\)) |
| 1304 | (eq (get-text-property (point) 'face) 'tex-verbatim) | 1306 | (eq (get-text-property (point) 'face) 'tex-verbatim) |
| 1305 | (save-excursion | 1307 | ;; Discover if a preceding occurrence of `tex-open-quote' |
| 1306 | (backward-char (length tex-open-quote)) | 1308 | ;; should be morphed to a normal double quote. |
| 1307 | (when (or (looking-at (regexp-quote tex-open-quote)) | 1309 | ;; |
| 1308 | (looking-at (regexp-quote tex-close-quote))) | 1310 | (and (>= (point) (+ (point-min) (length tex-open-quote))) |
| 1309 | (delete-char (length tex-open-quote)) | 1311 | (save-excursion |
| 1310 | t))) | 1312 | (backward-char (length tex-open-quote)) |
| 1313 | (when (or (looking-at (regexp-quote tex-open-quote)) | ||
| 1314 | (looking-at (regexp-quote tex-close-quote))) | ||
| 1315 | (delete-char (length tex-open-quote)) | ||
| 1316 | (when (looking-at (regexp-quote tex-close-quote)) | ||
| 1317 | (delete-char (length tex-close-quote))) | ||
| 1318 | t)))) | ||
| 1319 | ;; Insert the normal quote (eventually letting | ||
| 1320 | ;; `electric-pair-mode' do its thing). | ||
| 1321 | ;; | ||
| 1311 | (self-insert-command (prefix-numeric-value arg)) | 1322 | (self-insert-command (prefix-numeric-value arg)) |
| 1312 | (insert (if (or (memq (char-syntax (preceding-char)) '(?\( ?> ?\s)) | 1323 | ;; We'll be inserting fancy TeX quotes, but consider and imitate |
| 1313 | (memq (preceding-char) '(?~))) | 1324 | ;; `electric-pair-mode''s two behaviors: pair-insertion and |
| 1314 | tex-open-quote tex-close-quote)))) | 1325 | ;; region wrapping. |
| 1326 | ;; | ||
| 1327 | (if (and electric-pair-mode (use-region-p)) | ||
| 1328 | (let* ((saved (point-marker))) | ||
| 1329 | (goto-char (mark)) | ||
| 1330 | (insert (if (> saved (mark)) tex-open-quote tex-close-quote)) | ||
| 1331 | (goto-char saved) | ||
| 1332 | (insert (if (> saved (mark)) tex-close-quote tex-open-quote))) | ||
| 1333 | (if (or (memq (char-syntax (preceding-char)) '(?\( ?> ?\s)) | ||
| 1334 | (memq (preceding-char) '(?~))) | ||
| 1335 | (if electric-pair-mode | ||
| 1336 | (if (looking-at (regexp-quote tex-close-quote)) | ||
| 1337 | (forward-char (length tex-close-quote)) | ||
| 1338 | (insert tex-open-quote) | ||
| 1339 | (insert tex-close-quote) | ||
| 1340 | (backward-char (length tex-close-quote))) | ||
| 1341 | (insert tex-open-quote)) | ||
| 1342 | (if (looking-at (regexp-quote tex-close-quote)) | ||
| 1343 | (forward-char (length tex-close-quote)) | ||
| 1344 | (insert tex-close-quote)))))) | ||
| 1315 | 1345 | ||
| 1316 | (defun tex-validate-buffer () | 1346 | (defun tex-validate-buffer () |
| 1317 | "Check current buffer for paragraphs containing mismatched braces or $s. | 1347 | "Check current buffer for paragraphs containing mismatched braces or $s. |
diff --git a/lisp/vc/compare-w.el b/lisp/vc/compare-w.el index 3b8293cda24..454139e9025 100644 --- a/lisp/vc/compare-w.el +++ b/lisp/vc/compare-w.el | |||
| @@ -30,6 +30,8 @@ | |||
| 30 | 30 | ||
| 31 | ;;; Code: | 31 | ;;; Code: |
| 32 | 32 | ||
| 33 | (require 'diff-mode) ; For diff faces. | ||
| 34 | |||
| 33 | (defgroup compare-windows nil | 35 | (defgroup compare-windows nil |
| 34 | "Compare text between windows." | 36 | "Compare text between windows." |
| 35 | :prefix "compare-" | 37 | :prefix "compare-" |
| @@ -128,11 +130,19 @@ out all highlighting later with the command `compare-windows-dehighlight'." | |||
| 128 | :group 'compare-windows | 130 | :group 'compare-windows |
| 129 | :version "22.1") | 131 | :version "22.1") |
| 130 | 132 | ||
| 131 | (defface compare-windows | 133 | (defface compare-windows-removed |
| 132 | '((t :inherit lazy-highlight)) | 134 | '((t :inherit diff-removed)) |
| 133 | "Face for highlighting of compare-windows difference regions." | 135 | "Face for highlighting of compare-windows removed regions." |
| 134 | :group 'compare-windows | 136 | :group 'compare-windows |
| 135 | :version "22.1") | 137 | :version "25.1") |
| 138 | |||
| 139 | (defface compare-windows-added | ||
| 140 | '((t :inherit diff-added)) | ||
| 141 | "Face for highlighting of compare-windows added regions." | ||
| 142 | :group 'compare-windows | ||
| 143 | :version "25.1") | ||
| 144 | |||
| 145 | (define-obsolete-face-alias 'compare-windows 'compare-windows-added "25.1") | ||
| 136 | 146 | ||
| 137 | (defvar compare-windows-overlay1 nil) | 147 | (defvar compare-windows-overlay1 nil) |
| 138 | (defvar compare-windows-overlay2 nil) | 148 | (defvar compare-windows-overlay2 nil) |
| @@ -158,7 +168,8 @@ then try to get a window on an iconified frame, and finally | |||
| 158 | consider all existing frames." | 168 | consider all existing frames." |
| 159 | (or (get-mru-window 'visible t t) | 169 | (or (get-mru-window 'visible t t) |
| 160 | (get-mru-window 0 t t) | 170 | (get-mru-window 0 t t) |
| 161 | (get-mru-window t t t))) | 171 | (get-mru-window t t t) |
| 172 | (error "No other window"))) | ||
| 162 | 173 | ||
| 163 | (defun compare-windows-get-next-window () | 174 | (defun compare-windows-get-next-window () |
| 164 | "Return the window next in the cyclic ordering of windows. | 175 | "Return the window next in the cyclic ordering of windows. |
| @@ -393,13 +404,13 @@ on third call it again advances points to the next difference and so on." | |||
| 393 | (if compare-windows-overlay1 | 404 | (if compare-windows-overlay1 |
| 394 | (move-overlay compare-windows-overlay1 beg1 end1 b1) | 405 | (move-overlay compare-windows-overlay1 beg1 end1 b1) |
| 395 | (setq compare-windows-overlay1 (make-overlay beg1 end1 b1)) | 406 | (setq compare-windows-overlay1 (make-overlay beg1 end1 b1)) |
| 396 | (overlay-put compare-windows-overlay1 'face 'compare-windows) | 407 | (overlay-put compare-windows-overlay1 'face 'compare-windows-added) |
| 397 | (overlay-put compare-windows-overlay1 'priority 1000)) | 408 | (overlay-put compare-windows-overlay1 'priority 1000)) |
| 398 | (overlay-put compare-windows-overlay1 'window w1) | 409 | (overlay-put compare-windows-overlay1 'window w1) |
| 399 | (if compare-windows-overlay2 | 410 | (if compare-windows-overlay2 |
| 400 | (move-overlay compare-windows-overlay2 beg2 end2 b2) | 411 | (move-overlay compare-windows-overlay2 beg2 end2 b2) |
| 401 | (setq compare-windows-overlay2 (make-overlay beg2 end2 b2)) | 412 | (setq compare-windows-overlay2 (make-overlay beg2 end2 b2)) |
| 402 | (overlay-put compare-windows-overlay2 'face 'compare-windows) | 413 | (overlay-put compare-windows-overlay2 'face 'compare-windows-removed) |
| 403 | (overlay-put compare-windows-overlay2 'priority 1000)) | 414 | (overlay-put compare-windows-overlay2 'priority 1000)) |
| 404 | (overlay-put compare-windows-overlay2 'window w2) | 415 | (overlay-put compare-windows-overlay2 'window w2) |
| 405 | (if (not (eq compare-windows-highlight 'persistent)) | 416 | (if (not (eq compare-windows-highlight 'persistent)) |
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 4955c5abf93..08eb778f804 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el | |||
| @@ -169,6 +169,9 @@ See `run-hooks'." | |||
| 169 | (define-key map [ise] | 169 | (define-key map [ise] |
| 170 | '(menu-item "Isearch Files..." vc-dir-isearch | 170 | '(menu-item "Isearch Files..." vc-dir-isearch |
| 171 | :help "Incremental search a string in the marked files")) | 171 | :help "Incremental search a string in the marked files")) |
| 172 | (define-key map [display] | ||
| 173 | '(menu-item "Display in Other Window" vc-dir-display-file | ||
| 174 | :help "Display the file on the current line, in another window")) | ||
| 172 | (define-key map [open-other] | 175 | (define-key map [open-other] |
| 173 | '(menu-item "Open in Other Window" vc-dir-find-file-other-window | 176 | '(menu-item "Open in Other Window" vc-dir-find-file-other-window |
| 174 | :help "Find the file on the current line, in another window")) | 177 | :help "Find the file on the current line, in another window")) |
| @@ -273,6 +276,7 @@ See `run-hooks'." | |||
| 273 | (define-key map "e" 'vc-dir-find-file) ; dired-mode compatibility | 276 | (define-key map "e" 'vc-dir-find-file) ; dired-mode compatibility |
| 274 | (define-key map "\C-m" 'vc-dir-find-file) | 277 | (define-key map "\C-m" 'vc-dir-find-file) |
| 275 | (define-key map "o" 'vc-dir-find-file-other-window) | 278 | (define-key map "o" 'vc-dir-find-file-other-window) |
| 279 | (define-key map "\C-o" 'vc-dir-display-file) | ||
| 276 | (define-key map "\C-c\C-c" 'vc-dir-kill-dir-status-process) | 280 | (define-key map "\C-c\C-c" 'vc-dir-kill-dir-status-process) |
| 277 | (define-key map [down-mouse-3] 'vc-dir-menu) | 281 | (define-key map [down-mouse-3] 'vc-dir-menu) |
| 278 | (define-key map [mouse-2] 'vc-dir-toggle-mark) | 282 | (define-key map [mouse-2] 'vc-dir-toggle-mark) |
| @@ -755,6 +759,13 @@ that share the same state." | |||
| 755 | (if event (posn-set-point (event-end event))) | 759 | (if event (posn-set-point (event-end event))) |
| 756 | (find-file-other-window (vc-dir-current-file))) | 760 | (find-file-other-window (vc-dir-current-file))) |
| 757 | 761 | ||
| 762 | (defun vc-dir-display-file (&optional event) | ||
| 763 | "Display the file on the current line, in another window." | ||
| 764 | (interactive (list last-nonmenu-event)) | ||
| 765 | (if event (posn-set-point (event-end event))) | ||
| 766 | (display-buffer (find-file-noselect (vc-dir-current-file)) | ||
| 767 | t)) | ||
| 768 | |||
| 758 | (defun vc-dir-isearch () | 769 | (defun vc-dir-isearch () |
| 759 | "Search for a string through all marked buffers using Isearch." | 770 | "Search for a string through all marked buffers using Isearch." |
| 760 | (interactive) | 771 | (interactive) |
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 65f683c7808..1700bef10b0 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el | |||
| @@ -371,8 +371,7 @@ or an empty string if none." | |||
| 371 | (goto-char (point-min)) | 371 | (goto-char (point-min)) |
| 372 | (pcase stage | 372 | (pcase stage |
| 373 | (`update-index | 373 | (`update-index |
| 374 | (setq next-stage (if (vc-git--empty-db-p) 'ls-files-added | 374 | (setq next-stage (if (vc-git--empty-db-p) 'ls-files-added 'diff-index))) |
| 375 | (if files 'ls-files-up-to-date 'diff-index)))) | ||
| 376 | (`ls-files-added | 375 | (`ls-files-added |
| 377 | (setq next-stage 'ls-files-unknown) | 376 | (setq next-stage 'ls-files-unknown) |
| 378 | (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 0\t\\([^\0]+\\)\0" nil t) | 377 | (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 0\t\\([^\0]+\\)\0" nil t) |
| @@ -381,7 +380,7 @@ or an empty string if none." | |||
| 381 | (push (list name 'added (vc-git-create-extra-fileinfo 0 new-perm)) | 380 | (push (list name 'added (vc-git-create-extra-fileinfo 0 new-perm)) |
| 382 | result)))) | 381 | result)))) |
| 383 | (`ls-files-up-to-date | 382 | (`ls-files-up-to-date |
| 384 | (setq next-stage 'diff-index) | 383 | (setq next-stage 'ls-files-unknown) |
| 385 | (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 0\t\\([^\0]+\\)\0" nil t) | 384 | (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 0\t\\([^\0]+\\)\0" nil t) |
| 386 | (let ((perm (string-to-number (match-string 1) 8)) | 385 | (let ((perm (string-to-number (match-string 1) 8)) |
| 387 | (name (match-string 2))) | 386 | (name (match-string 2))) |
| @@ -400,7 +399,7 @@ or an empty string if none." | |||
| 400 | (vc-git-create-extra-fileinfo 0 0)) | 399 | (vc-git-create-extra-fileinfo 0 0)) |
| 401 | result))) | 400 | result))) |
| 402 | (`diff-index | 401 | (`diff-index |
| 403 | (setq next-stage 'ls-files-unknown) | 402 | (setq next-stage (if files 'ls-files-up-to-date 'ls-files-unknown)) |
| 404 | (while (re-search-forward | 403 | (while (re-search-forward |
| 405 | ":\\([0-7]\\{6\\}\\) \\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\(\\([ADMUT]\\)\0\\([^\0]+\\)\\|\\([CR]\\)[0-9]*\0\\([^\0]+\\)\0\\([^\0]+\\)\\)\0" | 404 | ":\\([0-7]\\{6\\}\\) \\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\(\\([ADMUT]\\)\0\\([^\0]+\\)\\|\\([CR]\\)[0-9]*\0\\([^\0]+\\)\0\\([^\0]+\\)\\)\0" |
| 406 | nil t 1) | 405 | nil t 1) |
diff --git a/lisp/window.el b/lisp/window.el index 2b593c35a54..21bd2c5829b 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -237,7 +237,12 @@ displays the buffer specified by BUFFER-OR-NAME before running BODY." | |||
| 237 | (standard-output ,buffer) | 237 | (standard-output ,buffer) |
| 238 | ,window ,value) | 238 | ,window ,value) |
| 239 | (with-current-buffer ,buffer | 239 | (with-current-buffer ,buffer |
| 240 | (setq ,window (temp-buffer-window-show ,buffer ,vaction))) | 240 | (setq ,window (temp-buffer-window-show |
| 241 | ,buffer | ||
| 242 | ;; Remove window-height when it's handled below. | ||
| 243 | (if (functionp (cdr (assq 'window-height (cdr ,vaction)))) | ||
| 244 | (assq-delete-all 'window-height (copy-sequence ,vaction)) | ||
| 245 | ,vaction)))) | ||
| 241 | 246 | ||
| 242 | (let ((inhibit-read-only t) | 247 | (let ((inhibit-read-only t) |
| 243 | (inhibit-modification-hooks t)) | 248 | (inhibit-modification-hooks t)) |