diff options
| author | Joakim Verona | 2013-07-20 01:44:36 +0200 |
|---|---|---|
| committer | Joakim Verona | 2013-07-20 01:44:36 +0200 |
| commit | 759dbb1aebe68fb392f7ed53eba4b460ae6b83be (patch) | |
| tree | 1becc0cc6d676589eb274cb2c457e4256e908010 /lisp | |
| parent | 6c1769c85ecb61b40a1f9a3b56b61cdd6c1f8992 (diff) | |
| parent | 3f5bef16fab0ba83cb2298f8137fec831af1aec4 (diff) | |
| download | emacs-759dbb1aebe68fb392f7ed53eba4b460ae6b83be.tar.gz emacs-759dbb1aebe68fb392f7ed53eba4b460ae6b83be.zip | |
Merge branch 'trunk' into xwidget
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 119 | ||||
| -rw-r--r-- | lisp/autorevert.el | 22 | ||||
| -rw-r--r-- | lisp/cedet/semantic/bovine/el.el | 2 | ||||
| -rw-r--r-- | lisp/desktop.el | 507 | ||||
| -rw-r--r-- | lisp/edmacro.el | 3 | ||||
| -rw-r--r-- | lisp/epa.el | 3 | ||||
| -rw-r--r-- | lisp/filenotify.el | 40 | ||||
| -rw-r--r-- | lisp/frame.el | 44 | ||||
| -rw-r--r-- | lisp/gnus/ChangeLog | 15 | ||||
| -rw-r--r-- | lisp/gnus/gnus-art.el | 13 | ||||
| -rw-r--r-- | lisp/gnus/gnus-start.el | 20 | ||||
| -rw-r--r-- | lisp/gnus/registry.el | 2 | ||||
| -rw-r--r-- | lisp/mail/mailalias.el | 4 | ||||
| -rw-r--r-- | lisp/net/eww.el | 2 | ||||
| -rw-r--r-- | lisp/net/shr.el | 14 | ||||
| -rw-r--r-- | lisp/net/tramp-adb.el | 3 | ||||
| -rw-r--r-- | lisp/net/tramp-compat.el | 4 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 3 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 13 | ||||
| -rw-r--r-- | lisp/net/tramp-smb.el | 3 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 4 | ||||
| -rw-r--r-- | lisp/org/org-freemind.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 43 | ||||
| -rw-r--r-- | lisp/shell.el | 18 | ||||
| -rw-r--r-- | lisp/simple.el | 21 | ||||
| -rw-r--r-- | lisp/subr.el | 63 |
26 files changed, 769 insertions, 218 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5451abc2119..6b99c5719bb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,118 @@ | |||
| 1 | 2013-07-19 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * net/shr.el (shr-mouse-browse-url): New command and keystroke | ||
| 4 | (bug#14815). | ||
| 5 | |||
| 6 | * net/eww.el (eww-process-text-input): Allow inputting when the | ||
| 7 | point is at the start of the line, as the properties aren't | ||
| 8 | front-sticky. | ||
| 9 | |||
| 10 | * net/shr.el (shr-make-table-1): Ensure that we don't infloop on | ||
| 11 | degenerate widths. | ||
| 12 | |||
| 13 | 2013-07-19 Richard Stallman <rms@gnu.org> | ||
| 14 | |||
| 15 | * epa.el (epa-popup-info-window): Doc fix. | ||
| 16 | |||
| 17 | * subr.el (split-string): New arg TRIM. | ||
| 18 | |||
| 19 | 2013-07-18 Juanma Barranquero <lekktu@gmail.com> | ||
| 20 | |||
| 21 | * frame.el (blink-cursor-timer-function, blink-cursor-suspend): | ||
| 22 | Add check for W32 (followup to 2013-07-16T11:41:06Z!jan.h.d@swipnet.se). | ||
| 23 | |||
| 24 | 2013-07-18 Michael Albinus <michael.albinus@gmx.de> | ||
| 25 | |||
| 26 | * filenotify.el (file-notify--library): Rename from | ||
| 27 | `file-notify-support'. Do not autoload. Adapt all uses. | ||
| 28 | (file-notify-supported-p): New defun. | ||
| 29 | |||
| 30 | * autorevert.el (auto-revert-use-notify): | ||
| 31 | Use `file-notify-supported-p' instead of `file-notify-support'. | ||
| 32 | Adapt docstring. | ||
| 33 | (auto-revert-notify-add-watch): Use `file-notify-supported-p'. | ||
| 34 | |||
| 35 | * net/tramp.el (tramp-file-name-for-operation): | ||
| 36 | Add `file-notify-supported-p'. | ||
| 37 | |||
| 38 | * net/tramp-sh.el (tramp-sh-handle-file-notify-supported-p): | ||
| 39 | New defun. | ||
| 40 | (tramp-sh-file-name-handler-alist): Add it as handler for | ||
| 41 | `file-notify-supported-p '. | ||
| 42 | |||
| 43 | * net/tramp-adb.el (tramp-adb-file-name-handler-alist): | ||
| 44 | * net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): | ||
| 45 | * net/tramp-smb.el (tramp-smb-file-name-handler-alist): | ||
| 46 | Add `ignore' as handler for `file-notify-*' functions. | ||
| 47 | |||
| 48 | 2013-07-17 Eli Zaretskii <eliz@gnu.org> | ||
| 49 | |||
| 50 | * simple.el (line-move-partial, line-move): Don't start vscroll or | ||
| 51 | scroll-up if the current line is not taller than the window. | ||
| 52 | (Bug#14881) | ||
| 53 | |||
| 54 | 2013-07-16 Dmitry Gutov <dgutov@yandex.ru> | ||
| 55 | |||
| 56 | * progmodes/ruby-mode.el (ruby-font-lock-keywords): Do not | ||
| 57 | highlight question marks in the method names as strings. | ||
| 58 | (ruby-block-beg-keywords): Inline. | ||
| 59 | (ruby-font-lock-keyword-beg-re): Extract from | ||
| 60 | `ruby-font-lock-keywords'. | ||
| 61 | |||
| 62 | 2013-07-16 Jan Djärv <jan.h.d@swipnet.se> | ||
| 63 | |||
| 64 | * frame.el (blink-cursor-blinks): New defcustom. | ||
| 65 | (blink-cursor-blinks-done): New defvar. | ||
| 66 | (blink-cursor-start): Set blink-cursor-blinks-done to 1. | ||
| 67 | (blink-cursor-timer-function): Check if number of blinks has been | ||
| 68 | done on X and NS. | ||
| 69 | (blink-cursor-suspend, blink-cursor-check): New defuns. | ||
| 70 | |||
| 71 | 2013-07-15 Glenn Morris <rgm@gnu.org> | ||
| 72 | |||
| 73 | * edmacro.el (edmacro-format-keys): Fix previous change. | ||
| 74 | |||
| 75 | 2013-07-15 Paul Eggert <eggert@cs.ucla.edu> | ||
| 76 | |||
| 77 | * shell.el (explicit-bash-args): Remove obsolete hack for Bash 1.x. | ||
| 78 | The hack didn't work outside English locales anyway. | ||
| 79 | |||
| 80 | 2013-07-15 Juanma Barranquero <lekktu@gmail.com> | ||
| 81 | |||
| 82 | * simple.el (define-alternatives): Rename from alternatives-define, | ||
| 83 | per RMS' suggestion. | ||
| 84 | |||
| 85 | 2013-07-14 Juanma Barranquero <lekktu@gmail.com> | ||
| 86 | |||
| 87 | * desktop.el (desktop-restore-frames): Change default to t. | ||
| 88 | (desktop-restore-in-current-display): Now offer more options. | ||
| 89 | (desktop-restoring-reuses-frames): New customization option. | ||
| 90 | (desktop--saved-states): Doc fix. | ||
| 91 | (desktop-filter-parameters-alist): New variable, renamed and expanded | ||
| 92 | from desktop--excluded-frame-parameters. | ||
| 93 | (desktop--target-display): New variable. | ||
| 94 | (desktop-switch-to-gui-p, desktop-switch-to-tty-p) | ||
| 95 | (desktop--filter-tty*, desktop--filter-*-color) | ||
| 96 | (desktop--filter-minibuffer, desktop--filter-restore-desktop-parm) | ||
| 97 | (desktop--filter-save-desktop-parm) | ||
| 98 | (desktop-restore-in-original-display-p): New functions. | ||
| 99 | (desktop--filter-frame-parms): Use new desktop-filter-parameters-alist. | ||
| 100 | (desktop--save-minibuffer-frames): New function, inspired by a similar | ||
| 101 | function from Martin Rudalics. | ||
| 102 | (desktop--save-frames): Call it; play nice with desktop-globals-to-save. | ||
| 103 | (desktop--restore-in-this-display-p): Remove. | ||
| 104 | (desktop--find-frame): Rename from desktop--find-frame-in-display | ||
| 105 | and add predicate argument. | ||
| 106 | (desktop--make-full-frame): Remove, integrated into desktop--make-frame. | ||
| 107 | (desktop--reuse-list): New variable. | ||
| 108 | (desktop--select-frame, desktop--make-frame, desktop--sort-states): | ||
| 109 | New functions. | ||
| 110 | (desktop--restore-frames): Add support for "minibuffer-special" frames. | ||
| 111 | |||
| 112 | 2013-07-14 Michael Albinus <michael.albinus@gmx.de> | ||
| 113 | |||
| 114 | * net/tramp-sh.el (tramp-sh-handle-vc-registered): Use `ignore-error'. | ||
| 115 | |||
| 1 | 2013-07-13 Dmitry Gutov <dgutov@yandex.ru> | 116 | 2013-07-13 Dmitry Gutov <dgutov@yandex.ru> |
| 2 | 117 | ||
| 3 | * progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight | 118 | * progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight |
| @@ -3475,8 +3590,8 @@ | |||
| 3475 | (prolog-char-quote-workaround): | 3590 | (prolog-char-quote-workaround): |
| 3476 | * progmodes/cperl-mode.el (cperl-under-as-char): | 3591 | * progmodes/cperl-mode.el (cperl-under-as-char): |
| 3477 | * progmodes/vhdl-mode.el (vhdl-underscore-is-part-of-word): | 3592 | * progmodes/vhdl-mode.el (vhdl-underscore-is-part-of-word): |
| 3478 | Mark as obsolete. | 3593 | Mark as obsolete. |
| 3479 | (vhdl-mode-syntax-table, vhdl-mode-ext-syntax-table): Initialize in | 3594 | (vhdl-mode-syntax-table, vhdl-mode-ext-syntax-table): Initialize in |
| 3480 | their declaration. | 3595 | their declaration. |
| 3481 | (vhdl-mode-syntax-table-init): Remove. | 3596 | (vhdl-mode-syntax-table-init): Remove. |
| 3482 | 3597 | ||
diff --git a/lisp/autorevert.el b/lisp/autorevert.el index 00e88fc4a3d..5c593e2ef71 100644 --- a/lisp/autorevert.el +++ b/lisp/autorevert.el | |||
| @@ -271,21 +271,20 @@ This variable becomes buffer local when set in any fashion.") | |||
| 271 | :type 'boolean | 271 | :type 'boolean |
| 272 | :version "24.4") | 272 | :version "24.4") |
| 273 | 273 | ||
| 274 | (defcustom auto-revert-use-notify (and file-notify-support t) | 274 | (defcustom auto-revert-use-notify |
| 275 | ;; We use the support of the local filesystem as default. | ||
| 276 | (file-notify-supported-p temporary-file-directory) | ||
| 275 | "If non-nil Auto Revert Mode uses file notification functions. | 277 | "If non-nil Auto Revert Mode uses file notification functions. |
| 276 | This requires Emacs being compiled with file notification | 278 | You should set this variable through Custom." |
| 277 | support (see `file-notify-support'). You should set this variable | ||
| 278 | through Custom." | ||
| 279 | :group 'auto-revert | 279 | :group 'auto-revert |
| 280 | :type 'boolean | 280 | :type 'boolean |
| 281 | :set (lambda (variable value) | 281 | :set (lambda (variable value) |
| 282 | (set-default variable (and file-notify-support value)) | 282 | (set-default variable value) |
| 283 | (unless (symbol-value variable) | 283 | (unless (symbol-value variable) |
| 284 | (when file-notify-support | 284 | (dolist (buf (buffer-list)) |
| 285 | (dolist (buf (buffer-list)) | 285 | (with-current-buffer buf |
| 286 | (with-current-buffer buf | 286 | (when (symbol-value 'auto-revert-notify-watch-descriptor) |
| 287 | (when (symbol-value 'auto-revert-notify-watch-descriptor) | 287 | (auto-revert-notify-rm-watch)))))) |
| 288 | (auto-revert-notify-rm-watch))))))) | ||
| 289 | :initialize 'custom-initialize-default | 288 | :initialize 'custom-initialize-default |
| 290 | :version "24.4") | 289 | :version "24.4") |
| 291 | 290 | ||
| @@ -513,7 +512,8 @@ will use an up-to-date value of `auto-revert-interval'" | |||
| 513 | (set (make-local-variable 'auto-revert-use-notify) nil)) | 512 | (set (make-local-variable 'auto-revert-use-notify) nil)) |
| 514 | 513 | ||
| 515 | (when (and buffer-file-name auto-revert-use-notify | 514 | (when (and buffer-file-name auto-revert-use-notify |
| 516 | (not auto-revert-notify-watch-descriptor)) | 515 | (not auto-revert-notify-watch-descriptor) |
| 516 | (file-notify-supported-p buffer-file-name)) | ||
| 517 | (setq auto-revert-notify-watch-descriptor | 517 | (setq auto-revert-notify-watch-descriptor |
| 518 | (ignore-errors | 518 | (ignore-errors |
| 519 | (file-notify-add-watch | 519 | (file-notify-add-watch |
diff --git a/lisp/cedet/semantic/bovine/el.el b/lisp/cedet/semantic/bovine/el.el index 07e0e08bbaf..0bbe3c61d76 100644 --- a/lisp/cedet/semantic/bovine/el.el +++ b/lisp/cedet/semantic/bovine/el.el | |||
| @@ -474,7 +474,7 @@ Return a bovination list to use." | |||
| 474 | ((and name (file-exists-p (concat name ".el.gz"))) | 474 | ((and name (file-exists-p (concat name ".el.gz"))) |
| 475 | ;; This is the linux distro case. | 475 | ;; This is the linux distro case. |
| 476 | (concat name ".el.gz")) | 476 | (concat name ".el.gz")) |
| 477 | ;; source file does not exists | 477 | ;; Source file does not exist. |
| 478 | (name | 478 | (name |
| 479 | (message "semantic: cannot find source file %s" (concat name ".el"))) | 479 | (message "semantic: cannot find source file %s" (concat name ".el"))) |
| 480 | (t | 480 | (t |
diff --git a/lisp/desktop.el b/lisp/desktop.el index fcd032a64d0..e62307d5959 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | ;; - the mark & mark-active | 33 | ;; - the mark & mark-active |
| 34 | ;; - buffer-read-only | 34 | ;; - buffer-read-only |
| 35 | ;; - some local variables | 35 | ;; - some local variables |
| 36 | ;; - frame and window configuration | ||
| 36 | 37 | ||
| 37 | ;; To use this, use customize to turn on desktop-save-mode or add the | 38 | ;; To use this, use customize to turn on desktop-save-mode or add the |
| 38 | ;; following line somewhere in your init file: | 39 | ;; following line somewhere in your init file: |
| @@ -127,7 +128,6 @@ | |||
| 127 | ;; --------------------------------------------------------------------------- | 128 | ;; --------------------------------------------------------------------------- |
| 128 | ;; TODO: | 129 | ;; TODO: |
| 129 | ;; | 130 | ;; |
| 130 | ;; Save window configuration. | ||
| 131 | ;; Recognize more minor modes. | 131 | ;; Recognize more minor modes. |
| 132 | ;; Save mark rings. | 132 | ;; Save mark rings. |
| 133 | 133 | ||
| @@ -369,16 +369,29 @@ modes are restored automatically; they should not be listed here." | |||
| 369 | :type '(repeat symbol) | 369 | :type '(repeat symbol) |
| 370 | :group 'desktop) | 370 | :group 'desktop) |
| 371 | 371 | ||
| 372 | (defcustom desktop-restore-frames nil | 372 | (defcustom desktop-restore-frames t |
| 373 | "When non-nil, save window/frame configuration to desktop file." | 373 | "When non-nil, save window/frame configuration to desktop file." |
| 374 | :type 'boolean | 374 | :type 'boolean |
| 375 | :group 'desktop | 375 | :group 'desktop |
| 376 | :version "24.4") | 376 | :version "24.4") |
| 377 | 377 | ||
| 378 | (defcustom desktop-restore-in-current-display nil | 378 | (defcustom desktop-restore-in-current-display nil |
| 379 | "When non-nil, frames are restored in the current display. | 379 | "If t, frames are restored in the current display. |
| 380 | Otherwise they are restored, if possible, in their original displays." | 380 | If nil, frames are restored, if possible, in their original displays. |
| 381 | :type 'boolean | 381 | If `delete', frames on other displays are deleted instead of restored." |
| 382 | :type '(choice (const :tag "Restore in current display" t) | ||
| 383 | (const :tag "Restore in original display" nil) | ||
| 384 | (const :tag "Delete frames in other displays" 'delete)) | ||
| 385 | :group 'desktop | ||
| 386 | :version "24.4") | ||
| 387 | |||
| 388 | (defcustom desktop-restoring-reuses-frames t | ||
| 389 | "If t, restoring frames reuses existing frames. | ||
| 390 | If nil, existing frames are deleted. | ||
| 391 | If `keep', existing frames are kept and not reused." | ||
| 392 | :type '(choice (const :tag "Reuse existing frames" t) | ||
| 393 | (const :tag "Delete existing frames" nil) | ||
| 394 | (const :tag "Keep existing frames" 'keep)) | ||
| 382 | :group 'desktop | 395 | :group 'desktop |
| 383 | :version "24.4") | 396 | :version "24.4") |
| 384 | 397 | ||
| @@ -566,7 +579,7 @@ DIRNAME omitted or nil means use `desktop-dirname'." | |||
| 566 | Used to avoid writing contents unchanged between auto-saves.") | 579 | Used to avoid writing contents unchanged between auto-saves.") |
| 567 | 580 | ||
| 568 | (defvar desktop--saved-states nil | 581 | (defvar desktop--saved-states nil |
| 569 | "Internal use only.") | 582 | "Saved window/frame state. Internal use only.") |
| 570 | 583 | ||
| 571 | ;; ---------------------------------------------------------------------------- | 584 | ;; ---------------------------------------------------------------------------- |
| 572 | ;; Desktop file conflict detection | 585 | ;; Desktop file conflict detection |
| @@ -869,30 +882,193 @@ DIRNAME must be the directory in which the desktop file will be saved." | |||
| 869 | 882 | ||
| 870 | 883 | ||
| 871 | ;; ---------------------------------------------------------------------------- | 884 | ;; ---------------------------------------------------------------------------- |
| 872 | (defconst desktop--excluded-frame-parameters | 885 | (defvar desktop-filter-parameters-alist |
| 873 | '(buffer-list | 886 | '((background-color . desktop--filter-*-color) |
| 874 | buffer-predicate | 887 | (buffer-list . t) |
| 875 | buried-buffer-list | 888 | (buffer-predicate . t) |
| 876 | explicit-name | 889 | (buried-buffer-list . t) |
| 877 | font | 890 | (desktop-font . desktop--filter-restore-desktop-parm) |
| 878 | font-backend | 891 | (desktop-fullscreen . desktop--filter-restore-desktop-parm) |
| 879 | minibuffer | 892 | (desktop-height . desktop--filter-restore-desktop-parm) |
| 880 | name | 893 | (desktop-width . desktop--filter-restore-desktop-parm) |
| 881 | outer-window-id | 894 | (font . desktop--filter-save-desktop-parm) |
| 882 | parent-id | 895 | (font-backend . t) |
| 883 | window-id | 896 | (foreground-color . desktop--filter-*-color) |
| 884 | window-system) | 897 | (fullscreen . desktop--filter-save-desktop-parm) |
| 885 | "Frame parameters not saved or restored.") | 898 | (height . desktop--filter-save-desktop-parm) |
| 886 | 899 | (minibuffer . desktop--filter-minibuffer) | |
| 887 | (defun desktop--filter-frame-parms (frame) | 900 | (name . t) |
| 888 | "Return frame parameters of FRAME. | 901 | (outer-window-id . t) |
| 889 | Parameters in `desktop--excluded-frame-parameters' are excluded. | 902 | (parent-id . t) |
| 903 | (tty . desktop--filter-tty*) | ||
| 904 | (tty-type . desktop--filter-tty*) | ||
| 905 | (width . desktop--filter-save-desktop-parm) | ||
| 906 | (window-id . t) | ||
| 907 | (window-system . t)) | ||
| 908 | "Alist of frame parameters and filtering functions. | ||
| 909 | |||
| 910 | Each element is a cons (PARAM . FILTER), where PARAM is a parameter | ||
| 911 | name (a symbol identifying a frame parameter), and FILTER can be t | ||
| 912 | \(meaning the parameter is removed from the parameter list on saving | ||
| 913 | and restoring), or a function that will be called with three args: | ||
| 914 | |||
| 915 | CURRENT a cons (PARAM . VALUE), where PARAM is the one being | ||
| 916 | filtered and VALUE is its current value | ||
| 917 | PARAMETERS the complete alist of parameters being filtered | ||
| 918 | SAVING non-nil if filtering before saving state, nil otherwise | ||
| 919 | |||
| 920 | The FILTER function must return: | ||
| 921 | nil CURRENT is removed from the list | ||
| 922 | t CURRENT is left as is | ||
| 923 | (PARAM' . VALUE') replace CURRENT with this | ||
| 924 | |||
| 925 | Frame parameters not on this list are passed intact.") | ||
| 926 | |||
| 927 | (defvar desktop--target-display nil | ||
| 928 | "Either (minibuffer . VALUE) or nil. | ||
| 929 | This refers to the current frame config being processed inside | ||
| 930 | `frame--restore-frames' and its auxiliary functions (like filtering). | ||
| 931 | If nil, there is no need to change the display. | ||
| 932 | If non-nil, display parameter to use when creating the frame. | ||
| 933 | Internal use only.") | ||
| 934 | |||
| 935 | (defun desktop-switch-to-gui-p (parameters) | ||
| 936 | "True when switching to a graphic display. | ||
| 937 | Return t if PARAMETERS describes a text-only terminal and | ||
| 938 | the target is a graphic display; otherwise return nil. | ||
| 939 | Only meaningful when called from a filtering function in | ||
| 940 | `desktop-filter-parameters-alist'." | ||
| 941 | (and desktop--target-display ; we're switching | ||
| 942 | (null (cdr (assq 'display parameters))) ; from a tty | ||
| 943 | (cdr desktop--target-display))) ; to a GUI display | ||
| 944 | |||
| 945 | (defun desktop-switch-to-tty-p (parameters) | ||
| 946 | "True when switching to a text-only terminal. | ||
| 947 | Return t if PARAMETERS describes a graphic display and | ||
| 948 | the target is a text-only terminal; otherwise return nil. | ||
| 949 | Only meaningful when called from a filtering function in | ||
| 950 | `desktop-filter-parameters-alist'." | ||
| 951 | (and desktop--target-display ; we're switching | ||
| 952 | (cdr (assq 'display parameters)) ; from a GUI display | ||
| 953 | (null (cdr desktop--target-display)))) ; to a tty | ||
| 954 | |||
| 955 | (defun desktop--filter-tty* (_current parameters saving) | ||
| 956 | ;; Remove tty and tty-type parameters when switching | ||
| 957 | ;; to a GUI frame. | ||
| 958 | (or saving | ||
| 959 | (not (desktop-switch-to-gui-p parameters)))) | ||
| 960 | |||
| 961 | (defun desktop--filter-*-color (current parameters saving) | ||
| 962 | ;; Remove (foreground|background)-color parameters | ||
| 963 | ;; when switching to a GUI frame if they denote an | ||
| 964 | ;; "unspecified" color. | ||
| 965 | (or saving | ||
| 966 | (not (desktop-switch-to-gui-p parameters)) | ||
| 967 | (not (stringp (cdr current))) | ||
| 968 | (not (string-match-p "^unspecified-[fb]g$" (cdr current))))) | ||
| 969 | |||
| 970 | (defun desktop--filter-minibuffer (current _parameters saving) | ||
| 971 | ;; When minibuffer is a window, save it as minibuffer . t | ||
| 972 | (or (not saving) | ||
| 973 | (if (windowp (cdr current)) | ||
| 974 | '(minibuffer . t) | ||
| 975 | t))) | ||
| 976 | |||
| 977 | (defun desktop--filter-restore-desktop-parm (current parameters saving) | ||
| 978 | ;; When switching to a GUI frame, convert desktop-XXX parameter to XXX | ||
| 979 | (or saving | ||
| 980 | (not (desktop-switch-to-gui-p parameters)) | ||
| 981 | (let ((val (cdr current))) | ||
| 982 | (if (eq val :desktop-processed) | ||
| 983 | nil | ||
| 984 | (cons (intern (substring (symbol-name (car current)) | ||
| 985 | 8)) ;; (length "desktop-") | ||
| 986 | val))))) | ||
| 987 | |||
| 988 | (defun desktop--filter-save-desktop-parm (current parameters saving) | ||
| 989 | ;; When switching to a tty frame, save parameter XXX as desktop-XXX so it | ||
| 990 | ;; can be restored in a subsequent GUI session, unless it already exists. | ||
| 991 | (cond (saving t) | ||
| 992 | ((desktop-switch-to-tty-p parameters) | ||
| 993 | (let ((sym (intern (format "desktop-%s" (car current))))) | ||
| 994 | (if (assq sym parameters) | ||
| 995 | nil | ||
| 996 | (cons sym (cdr current))))) | ||
| 997 | ((desktop-switch-to-gui-p parameters) | ||
| 998 | (let* ((dtp (assq (intern (format "desktop-%s" (car current))) | ||
| 999 | parameters)) | ||
| 1000 | (val (cdr dtp))) | ||
| 1001 | (if (eq val :desktop-processed) | ||
| 1002 | nil | ||
| 1003 | (setcdr dtp :desktop-processed) | ||
| 1004 | (cons (car current) val)))) | ||
| 1005 | (t t))) | ||
| 1006 | |||
| 1007 | (defun desktop-restore-in-original-display-p () | ||
| 1008 | "True if saved frames' displays should be honored." | ||
| 1009 | (cond ((daemonp) t) | ||
| 1010 | ((eq system-type 'windows-nt) nil) | ||
| 1011 | (t (null desktop-restore-in-current-display)))) | ||
| 1012 | |||
| 1013 | (defun desktop--filter-frame-parms (parameters saving) | ||
| 1014 | "Filter frame parameters and return filtered list. | ||
| 1015 | PARAMETERS is a parameter alist as returned by `frame-parameters'. | ||
| 1016 | If SAVING is non-nil, filtering is happening before saving frame state; | ||
| 1017 | otherwise, filtering is being done before restoring frame state. | ||
| 1018 | Parameters are filtered according to the setting of | ||
| 1019 | `desktop-filter-parameters-alist' (which see). | ||
| 890 | Internal use only." | 1020 | Internal use only." |
| 891 | (let (params) | 1021 | (let ((filtered nil)) |
| 892 | (dolist (param (frame-parameters frame)) | 1022 | (dolist (param parameters) |
| 893 | (unless (memq (car param) desktop--excluded-frame-parameters) | 1023 | (let ((filter (cdr (assq (car param) desktop-filter-parameters-alist))) |
| 894 | (push param params))) | 1024 | this) |
| 895 | params)) | 1025 | (cond (;; no filter: pass param |
| 1026 | (null filter) | ||
| 1027 | (push param filtered)) | ||
| 1028 | (;; filter = t; skip param | ||
| 1029 | (eq filter t)) | ||
| 1030 | (;; filter func returns nil: skip param | ||
| 1031 | (null (setq this (funcall filter param parameters saving)))) | ||
| 1032 | (;; filter func returns t: pass param | ||
| 1033 | (eq this t) | ||
| 1034 | (push param filtered)) | ||
| 1035 | (;; filter func returns a new param: use it | ||
| 1036 | t | ||
| 1037 | (push this filtered))))) | ||
| 1038 | ;; Set the display parameter after filtering, so that filter functions | ||
| 1039 | ;; have access to its original value. | ||
| 1040 | (when desktop--target-display | ||
| 1041 | (let ((display (assq 'display filtered))) | ||
| 1042 | (if display | ||
| 1043 | (setcdr display (cdr desktop--target-display)) | ||
| 1044 | (push desktop--target-display filtered)))) | ||
| 1045 | filtered)) | ||
| 1046 | |||
| 1047 | (defun desktop--save-minibuffer-frames () | ||
| 1048 | ;; Adds a desktop-mini parameter to frames | ||
| 1049 | ;; desktop-mini is a list (MINIBUFFER NUMBER DEFAULT?) where | ||
| 1050 | ;; MINIBUFFER t if the frame (including minibuffer-only) owns a minibuffer | ||
| 1051 | ;; NUMBER if MINIBUFFER = t, an ID for the frame; if nil, the ID of | ||
| 1052 | ;; the frame containing the minibuffer used by this frame | ||
| 1053 | ;; DEFAULT? if t, this frame is the value of default-minibuffer-frame | ||
| 1054 | ;; FIXME: What happens with multi-terminal sessions? | ||
| 1055 | (let ((frames (frame-list)) | ||
| 1056 | (count 0)) | ||
| 1057 | ;; Reset desktop-mini for all frames | ||
| 1058 | (dolist (frame frames) | ||
| 1059 | (set-frame-parameter frame 'desktop-mini nil)) | ||
| 1060 | ;; Number all frames with its own minibuffer | ||
| 1061 | (dolist (frame (minibuffer-frame-list)) | ||
| 1062 | (set-frame-parameter frame 'desktop-mini | ||
| 1063 | (list t | ||
| 1064 | (setq count (1+ count)) | ||
| 1065 | (eq frame default-minibuffer-frame)))) | ||
| 1066 | ;; Now link minibufferless frames with their minibuffer frames | ||
| 1067 | (dolist (frame frames) | ||
| 1068 | (unless (frame-parameter frame 'desktop-mini) | ||
| 1069 | (let* ((mb-frame (window-frame (minibuffer-window frame))) | ||
| 1070 | (this (cadr (frame-parameter mb-frame 'desktop-mini)))) | ||
| 1071 | (set-frame-parameter frame 'desktop-mini (list nil this nil))))))) | ||
| 896 | 1072 | ||
| 897 | (defun desktop--save-frames () | 1073 | (defun desktop--save-frames () |
| 898 | "Save window/frame state, as a global variable. | 1074 | "Save window/frame state, as a global variable. |
| @@ -900,12 +1076,14 @@ Intended to be called from `desktop-save'. | |||
| 900 | Internal use only." | 1076 | Internal use only." |
| 901 | (setq desktop--saved-states | 1077 | (setq desktop--saved-states |
| 902 | (and desktop-restore-frames | 1078 | (and desktop-restore-frames |
| 903 | (mapcar (lambda (frame) | 1079 | (progn |
| 904 | (cons (desktop--filter-frame-parms frame) | 1080 | (desktop--save-minibuffer-frames) |
| 905 | (window-state-get (frame-root-window frame) t))) | 1081 | (mapcar (lambda (frame) |
| 906 | (cons (selected-frame) | 1082 | (cons (desktop--filter-frame-parms (frame-parameters frame) t) |
| 907 | (delq (selected-frame) (frame-list)))))) | 1083 | (window-state-get (frame-root-window frame) t))) |
| 908 | (desktop-outvar 'desktop--saved-states)) | 1084 | (frame-list))))) |
| 1085 | (unless (memq 'desktop--saved-states desktop-globals-to-save) | ||
| 1086 | (desktop-outvar 'desktop--saved-states))) | ||
| 909 | 1087 | ||
| 910 | ;;;###autoload | 1088 | ;;;###autoload |
| 911 | (defun desktop-save (dirname &optional release auto-save) | 1089 | (defun desktop-save (dirname &optional release auto-save) |
| @@ -1006,71 +1184,220 @@ This function also sets `desktop-dirname' to nil." | |||
| 1006 | (defvar desktop-lazy-timer nil) | 1184 | (defvar desktop-lazy-timer nil) |
| 1007 | 1185 | ||
| 1008 | ;; ---------------------------------------------------------------------------- | 1186 | ;; ---------------------------------------------------------------------------- |
| 1009 | (defun desktop--restore-in-this-display-p () | 1187 | (defvar desktop--reuse-list nil |
| 1010 | (or desktop-restore-in-current-display | 1188 | "Internal use only.") |
| 1011 | (and (eq system-type 'windows-nt) (not (display-graphic-p))))) | 1189 | |
| 1012 | 1190 | (defun desktop--find-frame (predicate display &rest args) | |
| 1013 | (defun desktop--find-frame-in-display (frames display) | 1191 | "Find a suitable frame in `desktop--reuse-list'. |
| 1014 | (let (result) | 1192 | Look through frames whose display property matches DISPLAY and |
| 1015 | (while (and frames (not result)) | 1193 | return the first one for which (PREDICATE frame ARGS) returns t. |
| 1016 | (if (equal display (frame-parameter (car frames) 'display)) | 1194 | If PREDICATE is nil, it is always satisfied. Internal use only. |
| 1017 | (setq result (car frames)) | 1195 | This is an auxiliary function for `desktop--select-frame'." |
| 1018 | (setq frames (cdr frames)))) | 1196 | (catch :found |
| 1019 | result)) | 1197 | (dolist (frame desktop--reuse-list) |
| 1020 | 1198 | (when (and (equal (frame-parameter frame 'display) display) | |
| 1021 | (defun desktop--make-full-frame (full display config) | 1199 | (or (null predicate) |
| 1022 | (let ((width (and (eq full 'fullheight) (cdr (assq 'width config)))) | 1200 | (apply predicate frame args))) |
| 1023 | (height (and (eq full 'fullwidth) (cdr (assq 'height config)))) | 1201 | (throw :found frame))) |
| 1024 | (params '((visibility))) | 1202 | nil)) |
| 1203 | |||
| 1204 | (defun desktop--select-frame (display frame-cfg) | ||
| 1205 | "Look for an existing frame to reuse. | ||
| 1206 | DISPLAY is the display where the frame will be shown, and FRAME-CFG | ||
| 1207 | is the parameter list of the frame being restored. Internal use only." | ||
| 1208 | (if (eq desktop-restoring-reuses-frames t) | ||
| 1209 | (let ((frame nil) | ||
| 1210 | mini) | ||
| 1211 | ;; There are no fancy heuristics there. We could implement some | ||
| 1212 | ;; based on frame size and/or position, etc., but it is not clear | ||
| 1213 | ;; that any "gain" (in the sense of reduced flickering, etc.) is | ||
| 1214 | ;; worth the added complexity. In fact, the code below mainly | ||
| 1215 | ;; tries to work nicely when M-x desktop-read is used after a desktop | ||
| 1216 | ;; session has already been loaded. The other main use case, which | ||
| 1217 | ;; is the initial desktop-read upon starting Emacs, should usually | ||
| 1218 | ;; only have one, or very few, frame(s) to reuse. | ||
| 1219 | (cond (;; When the target is tty, every existing frame is reusable. | ||
| 1220 | (null display) | ||
| 1221 | (setq frame (desktop--find-frame nil display))) | ||
| 1222 | (;; If the frame has its own minibuffer, let's see whether | ||
| 1223 | ;; that frame has already been loaded (which can happen after | ||
| 1224 | ;; M-x desktop-read). | ||
| 1225 | (car (setq mini (cdr (assq 'desktop-mini frame-cfg)))) | ||
| 1226 | (setq frame (or (desktop--find-frame | ||
| 1227 | (lambda (f m) | ||
| 1228 | (equal (frame-parameter f 'desktop-mini) m)) | ||
| 1229 | display mini)))) | ||
| 1230 | (;; For minibufferless frames, check whether they already exist, | ||
| 1231 | ;; and that they are linked to the right minibuffer frame. | ||
| 1232 | mini | ||
| 1233 | (setq frame (desktop--find-frame | ||
| 1234 | (lambda (f n) | ||
| 1235 | (let ((m (frame-parameter f 'desktop-mini))) | ||
| 1236 | (and m | ||
| 1237 | (null (car m)) | ||
| 1238 | (= (cadr m) n) | ||
| 1239 | (equal (cadr (frame-parameter | ||
| 1240 | (window-frame (minibuffer-window f)) | ||
| 1241 | 'desktop-mini)) | ||
| 1242 | n)))) | ||
| 1243 | display (cadr mini)))) | ||
| 1244 | (;; Default to just finding a frame in the same display. | ||
| 1245 | t | ||
| 1246 | (setq frame (desktop--find-frame nil display)))) | ||
| 1247 | ;; If found, remove from the list. | ||
| 1248 | (when frame | ||
| 1249 | (setq desktop--reuse-list (delq frame desktop--reuse-list))) | ||
| 1025 | frame) | 1250 | frame) |
| 1026 | (when width | 1251 | nil)) |
| 1027 | (setq params (append `((user-size . t) (width . ,width)) params) | 1252 | |
| 1028 | config (assq-delete-all 'height config))) | 1253 | (defun desktop--make-frame (frame-cfg window-cfg) |
| 1029 | (when height | 1254 | "Set up a frame according to its saved state. |
| 1030 | (setq params (append `((user-size . t) (height . ,height)) params) | 1255 | That means either creating a new frame or reusing an existing one. |
| 1031 | config (assq-delete-all 'width config))) | 1256 | FRAME-CFG is the parameter list of the new frame; WINDOW-CFG is |
| 1032 | (setq frame (make-frame-on-display display params)) | 1257 | its window state. Internal use only." |
| 1033 | (modify-frame-parameters frame config) | 1258 | (let* ((fullscreen (cdr (assq 'fullscreen frame-cfg))) |
| 1259 | (lines (assq 'tool-bar-lines frame-cfg)) | ||
| 1260 | (filtered-cfg (desktop--filter-frame-parms frame-cfg nil)) | ||
| 1261 | (display (cdr (assq 'display filtered-cfg))) ;; post-filtering | ||
| 1262 | alt-cfg frame) | ||
| 1263 | |||
| 1264 | ;; This works around bug#14795 (or feature#14795, if not a bug :-) | ||
| 1265 | (setq filtered-cfg (assq-delete-all 'tool-bar-lines filtered-cfg)) | ||
| 1266 | (push '(tool-bar-lines . 0) filtered-cfg) | ||
| 1267 | |||
| 1268 | (when fullscreen | ||
| 1269 | ;; Currently Emacs has the limitation that it does not record the size | ||
| 1270 | ;; and position of a frame before maximizing it, so we cannot save & | ||
| 1271 | ;; restore that info. Instead, when restoring, we resort to creating | ||
| 1272 | ;; invisible "fullscreen" frames of default size and then maximizing them | ||
| 1273 | ;; (and making them visible) which at least is somewhat user-friendly | ||
| 1274 | ;; when these frames are later de-maximized. | ||
| 1275 | (let ((width (and (eq fullscreen 'fullheight) (cdr (assq 'width filtered-cfg)))) | ||
| 1276 | (height (and (eq fullscreen 'fullwidth) (cdr (assq 'height filtered-cfg)))) | ||
| 1277 | (visible (assq 'visibility filtered-cfg))) | ||
| 1278 | (dolist (parameter '(visibility fullscreen width height)) | ||
| 1279 | (setq filtered-cfg (assq-delete-all parameter filtered-cfg))) | ||
| 1280 | (when width | ||
| 1281 | (setq filtered-cfg (append `((user-size . t) (width . ,width)) | ||
| 1282 | filtered-cfg))) | ||
| 1283 | (when height | ||
| 1284 | (setq filtered-cfg (append `((user-size . t) (height . ,height)) | ||
| 1285 | filtered-cfg))) | ||
| 1286 | ;; These are parameters to apply after creating/setting the frame. | ||
| 1287 | (push visible alt-cfg) | ||
| 1288 | (push (cons 'fullscreen fullscreen) alt-cfg))) | ||
| 1289 | |||
| 1290 | ;; Time to select or create a frame an apply the big bunch of parameters | ||
| 1291 | (if (setq frame (desktop--select-frame display filtered-cfg)) | ||
| 1292 | (modify-frame-parameters frame filtered-cfg) | ||
| 1293 | (setq frame (make-frame-on-display display filtered-cfg))) | ||
| 1294 | |||
| 1295 | ;; Let's give the finishing touches (visibility, tool-bar, maximization). | ||
| 1296 | (when lines (push lines alt-cfg)) | ||
| 1297 | (when alt-cfg (modify-frame-parameters frame alt-cfg)) | ||
| 1298 | ;; Now restore window state. | ||
| 1299 | (window-state-put window-cfg (frame-root-window frame) 'safe) | ||
| 1034 | frame)) | 1300 | frame)) |
| 1035 | 1301 | ||
| 1302 | (defun desktop--sort-states (state1 state2) | ||
| 1303 | ;; Order: default minibuffer frame | ||
| 1304 | ;; other frames with minibuffer, ascending ID | ||
| 1305 | ;; minibufferless frames, ascending ID | ||
| 1306 | (let ((dm1 (cdr (assq 'desktop-mini (car state1)))) | ||
| 1307 | (dm2 (cdr (assq 'desktop-mini (car state2))))) | ||
| 1308 | (cond ((nth 2 dm1) t) | ||
| 1309 | ((nth 2 dm2) nil) | ||
| 1310 | ((null (car dm2)) t) | ||
| 1311 | ((null (car dm1)) nil) | ||
| 1312 | (t (< (cadr dm1) (cadr dm2)))))) | ||
| 1313 | |||
| 1036 | (defun desktop--restore-frames () | 1314 | (defun desktop--restore-frames () |
| 1037 | "Restore window/frame configuration. | 1315 | "Restore window/frame configuration. |
| 1038 | Internal use only." | 1316 | Internal use only." |
| 1039 | (when (and desktop-restore-frames desktop--saved-states) | 1317 | (when (and desktop-restore-frames desktop--saved-states) |
| 1040 | (let ((frames (frame-list)) | 1318 | (let* ((frame-mb-map nil) ;; Alist of frames with their own minibuffer |
| 1041 | (current (frame-parameter nil 'display)) | 1319 | (visible nil) |
| 1042 | (selected nil)) | 1320 | (delete-saved (eq desktop-restore-in-current-display 'delete)) |
| 1321 | (forcing (not (desktop-restore-in-original-display-p))) | ||
| 1322 | (target (and forcing (cons 'display (frame-parameter nil 'display))))) | ||
| 1323 | |||
| 1324 | ;; Sorting saved states allows us to easily restore minibuffer-owning frames | ||
| 1325 | ;; before minibufferless ones. | ||
| 1326 | (setq desktop--saved-states (sort desktop--saved-states #'desktop--sort-states)) | ||
| 1327 | ;; Potentially all existing frames are reusable. Later we will decide which ones | ||
| 1328 | ;; to reuse, and how to deal with any leftover. | ||
| 1329 | (setq desktop--reuse-list (frame-list)) | ||
| 1330 | |||
| 1043 | (dolist (state desktop--saved-states) | 1331 | (dolist (state desktop--saved-states) |
| 1044 | (condition-case err | 1332 | (condition-case err |
| 1045 | (let* ((config (car state)) | 1333 | (let* ((frame-cfg (car state)) |
| 1046 | (display (if (desktop--restore-in-this-display-p) | 1334 | (window-cfg (cdr state)) |
| 1047 | (setcdr (assq 'display config) current) | 1335 | (d-mini (cdr (assq 'desktop-mini frame-cfg))) |
| 1048 | (cdr (assq 'display config)))) | 1336 | num frame to-tty) |
| 1049 | (full (cdr (assq 'fullscreen config))) | 1337 | ;; Only set target if forcing displays and the target display is different. |
| 1050 | (frame (and (not full) | 1338 | (if (or (not forcing) |
| 1051 | (desktop--find-frame-in-display frames display)))) | 1339 | (equal target (or (assq 'display frame-cfg) '(display . nil)))) |
| 1052 | (cond (full | 1340 | (setq desktop--target-display nil) |
| 1053 | ;; treat fullscreen/maximized frames specially | 1341 | (setq desktop--target-display target |
| 1054 | (setq frame (desktop--make-full-frame full display config))) | 1342 | to-tty (null (cdr target)))) |
| 1055 | (frame | 1343 | ;; Time to restore frames and set up their minibuffers as they were. |
| 1056 | ;; found a frame in the right display -- reuse | 1344 | ;; We only skip a frame (thus deleting it) if either: |
| 1057 | (setq frames (delq frame frames)) | 1345 | ;; - we're switching displays, and the user chose the option to delete, or |
| 1058 | (modify-frame-parameters frame config)) | 1346 | ;; - we're switching to tty, and the frame to restore is minibuffer-only. |
| 1059 | (t | 1347 | (unless (and desktop--target-display |
| 1060 | ;; no frames in the display -- make a new one | 1348 | (or delete-saved |
| 1061 | (setq frame (make-frame-on-display display config)))) | 1349 | (and to-tty |
| 1062 | ;; restore windows | 1350 | (eq (cdr (assq 'minibuffer frame-cfg)) 'only)))) |
| 1063 | (window-state-put (cdr state) (frame-root-window frame) 'safe) | 1351 | |
| 1064 | (unless selected (setq selected frame))) | 1352 | ;; Restore minibuffers. Some of this stuff could be done in a filter |
| 1353 | ;; function, but it would be messy because restoring minibuffers affects | ||
| 1354 | ;; global state; it's best to do it here than add a bunch of global | ||
| 1355 | ;; variables to pass info back-and-forth to/from the filter function. | ||
| 1356 | (cond | ||
| 1357 | ((null d-mini)) ;; No desktop-mini. Process as normal frame. | ||
| 1358 | (to-tty) ;; Ignore minibuffer stuff and process as normal frame. | ||
| 1359 | ((car d-mini) ;; Frame has its own minibuffer (or it is minibuffer-only). | ||
| 1360 | (setq num (cadr d-mini)) | ||
| 1361 | (when (eq (cdr (assq 'minibuffer frame-cfg)) 'only) | ||
| 1362 | (setq frame-cfg (append '((tool-bar-lines . 0) (menu-bar-lines . 0)) | ||
| 1363 | frame-cfg)))) | ||
| 1364 | (t ;; Frame depends on other frame's minibufer window. | ||
| 1365 | (let ((mb-frame (cdr (assq (cadr d-mini) frame-mb-map)))) | ||
| 1366 | (unless (frame-live-p mb-frame) | ||
| 1367 | (error "Minibuffer frame %s not found" (cadr d-mini))) | ||
| 1368 | (let ((mb-param (assq 'minibuffer frame-cfg)) | ||
| 1369 | (mb-window (minibuffer-window mb-frame))) | ||
| 1370 | (unless (and (window-live-p mb-window) | ||
| 1371 | (window-minibuffer-p mb-window)) | ||
| 1372 | (error "Not a minibuffer window %s" mb-window)) | ||
| 1373 | (if mb-param | ||
| 1374 | (setcdr mb-param mb-window) | ||
| 1375 | (push (cons 'minibuffer mb-window) frame-cfg)))))) | ||
| 1376 | ;; OK, we're ready at last to create (or reuse) a frame and | ||
| 1377 | ;; restore the window config. | ||
| 1378 | (setq frame (desktop--make-frame frame-cfg window-cfg)) | ||
| 1379 | ;; Set default-minibuffer if required. | ||
| 1380 | (when (nth 2 d-mini) (setq default-minibuffer-frame frame)) | ||
| 1381 | ;; Store frame/NUM to assign to minibufferless frames. | ||
| 1382 | (when num (push (cons num frame) frame-mb-map)) | ||
| 1383 | ;; Try to locate at least one visible frame. | ||
| 1384 | (when (and (not visible) (frame-visible-p frame)) | ||
| 1385 | (setq visible frame)))) | ||
| 1065 | (error | 1386 | (error |
| 1066 | (message "Error restoring frame: %S" (error-message-string err))))) | 1387 | (delay-warning 'desktop (error-message-string err) :error)))) |
| 1067 | (when selected | 1388 | |
| 1068 | ;; make sure the original selected frame is visible and selected | 1389 | ;; Delete remaining frames, but do not fail if some resist being deleted. |
| 1069 | (unless (or (frame-parameter selected 'visibility) (daemonp)) | 1390 | (unless (eq desktop-restoring-reuses-frames 'keep) |
| 1070 | (modify-frame-parameters selected '((visibility . t)))) | 1391 | (dolist (frame desktop--reuse-list) |
| 1071 | (select-frame-set-input-focus selected) | 1392 | (ignore-errors (delete-frame frame)))) |
| 1072 | ;; delete any remaining frames | 1393 | (setq desktop--reuse-list nil) |
| 1073 | (mapc #'delete-frame frames))))) | 1394 | ;; Make sure there's at least one visible frame, and select it. |
| 1395 | (unless (or visible (daemonp)) | ||
| 1396 | (setq visible (if (frame-live-p default-minibuffer-frame) | ||
| 1397 | default-minibuffer-frame | ||
| 1398 | (car (frame-list)))) | ||
| 1399 | (make-frame-visible visible) | ||
| 1400 | (select-frame-set-input-focus visible))))) | ||
| 1074 | 1401 | ||
| 1075 | ;;;###autoload | 1402 | ;;;###autoload |
| 1076 | (defun desktop-read (&optional dirname) | 1403 | (defun desktop-read (&optional dirname) |
diff --git a/lisp/edmacro.el b/lisp/edmacro.el index 67992d16527..73662951188 100644 --- a/lisp/edmacro.el +++ b/lisp/edmacro.el | |||
| @@ -562,7 +562,8 @@ doubt, use whitespace." | |||
| 562 | (unless (string-match " " desc) | 562 | (unless (string-match " " desc) |
| 563 | (let ((times 1) (pos bind-len)) | 563 | (let ((times 1) (pos bind-len)) |
| 564 | (while (not (cl-mismatch rest-mac rest-mac | 564 | (while (not (cl-mismatch rest-mac rest-mac |
| 565 | 0 bind-len pos (+ bind-len pos))) | 565 | :start1 0 :end1 bind-len |
| 566 | :start2 pos :end2 (+ bind-len pos))) | ||
| 566 | (cl-incf times) | 567 | (cl-incf times) |
| 567 | (cl-incf pos bind-len)) | 568 | (cl-incf pos bind-len)) |
| 568 | (when (> times 1) | 569 | (when (> times 1) |
diff --git a/lisp/epa.el b/lisp/epa.el index 14f8879c1c6..68e7a18fe17 100644 --- a/lisp/epa.el +++ b/lisp/epa.el | |||
| @@ -34,8 +34,7 @@ | |||
| 34 | :group 'epg) | 34 | :group 'epg) |
| 35 | 35 | ||
| 36 | (defcustom epa-popup-info-window t | 36 | (defcustom epa-popup-info-window t |
| 37 | "If non-nil, status information from epa commands is displayed on | 37 | "If non-nil, display status information from epa commands in another window." |
| 38 | the separate window." | ||
| 39 | :type 'boolean | 38 | :type 'boolean |
| 40 | :group 'epa) | 39 | :group 'epa) |
| 41 | 40 | ||
diff --git a/lisp/filenotify.el b/lisp/filenotify.el index e170db2dd5f..c9a7e106faa 100644 --- a/lisp/filenotify.el +++ b/lisp/filenotify.el | |||
| @@ -27,8 +27,7 @@ | |||
| 27 | 27 | ||
| 28 | ;;; Code: | 28 | ;;; Code: |
| 29 | 29 | ||
| 30 | ;;;###autoload | 30 | (defconst file-notify--library |
| 31 | (defconst file-notify-support | ||
| 32 | (cond | 31 | (cond |
| 33 | ((featurep 'gfilenotify) 'gfilenotify) | 32 | ((featurep 'gfilenotify) 'gfilenotify) |
| 34 | ((featurep 'inotify) 'inotify) | 33 | ((featurep 'inotify) 'inotify) |
| @@ -191,6 +190,17 @@ car of that event, which is the symbol `file-notify'." | |||
| 191 | (funcall callback (list desc action file file1)) | 190 | (funcall callback (list desc action file file1)) |
| 192 | (funcall callback (list desc action file))))))) | 191 | (funcall callback (list desc action file))))))) |
| 193 | 192 | ||
| 193 | (defun file-notify-supported-p (file) | ||
| 194 | "Returns non-nil if filesystem pertaining to FILE could be watched." | ||
| 195 | (unless (stringp file) | ||
| 196 | (signal 'wrong-type-argument (list file))) | ||
| 197 | (setq file (expand-file-name file)) | ||
| 198 | |||
| 199 | (let ((handler (find-file-name-handler file 'file-notify-supported-p))) | ||
| 200 | (if handler | ||
| 201 | (funcall handler 'file-notify-supported-p file) | ||
| 202 | (and file-notify--library t)))) | ||
| 203 | |||
| 194 | (defun file-notify-add-watch (file flags callback) | 204 | (defun file-notify-add-watch (file flags callback) |
| 195 | "Add a watch for filesystem events pertaining to FILE. | 205 | "Add a watch for filesystem events pertaining to FILE. |
| 196 | This arranges for filesystem events pertaining to FILE to be reported | 206 | This arranges for filesystem events pertaining to FILE to be reported |
| @@ -238,7 +248,7 @@ FILE is the name of the file whose event is being reported." | |||
| 238 | 248 | ||
| 239 | (let* ((handler (find-file-name-handler file 'file-notify-add-watch)) | 249 | (let* ((handler (find-file-name-handler file 'file-notify-add-watch)) |
| 240 | (dir (directory-file-name | 250 | (dir (directory-file-name |
| 241 | (if (or (and (not handler) (eq file-notify-support 'w32notify)) | 251 | (if (or (and (not handler) (eq file-notify--library 'w32notify)) |
| 242 | (file-directory-p file)) | 252 | (file-directory-p file)) |
| 243 | file | 253 | file |
| 244 | (file-name-directory file)))) | 254 | (file-name-directory file)))) |
| @@ -259,32 +269,32 @@ FILE is the name of the file whose event is being reported." | |||
| 259 | 269 | ||
| 260 | ;; Check, whether Emacs has been compiled with file | 270 | ;; Check, whether Emacs has been compiled with file |
| 261 | ;; notification support. | 271 | ;; notification support. |
| 262 | (unless file-notify-support | 272 | (unless file-notify--library |
| 263 | (signal 'file-notify-error | 273 | (signal 'file-notify-error |
| 264 | '("No file notification package available"))) | 274 | '("No file notification package available"))) |
| 265 | 275 | ||
| 266 | ;; Determine low-level function to be called. | 276 | ;; Determine low-level function to be called. |
| 267 | (setq func (cond | 277 | (setq func (cond |
| 268 | ((eq file-notify-support 'gfilenotify) 'gfile-add-watch) | 278 | ((eq file-notify--library 'gfilenotify) 'gfile-add-watch) |
| 269 | ((eq file-notify-support 'inotify) 'inotify-add-watch) | 279 | ((eq file-notify--library 'inotify) 'inotify-add-watch) |
| 270 | ((eq file-notify-support 'w32notify) 'w32notify-add-watch))) | 280 | ((eq file-notify--library 'w32notify) 'w32notify-add-watch))) |
| 271 | 281 | ||
| 272 | ;; Determine respective flags. | 282 | ;; Determine respective flags. |
| 273 | (if (eq file-notify-support 'gfilenotify) | 283 | (if (eq file-notify--library 'gfilenotify) |
| 274 | (setq l-flags '(watch-mounts send-moved)) | 284 | (setq l-flags '(watch-mounts send-moved)) |
| 275 | (when (memq 'change flags) | 285 | (when (memq 'change flags) |
| 276 | (setq | 286 | (setq |
| 277 | l-flags | 287 | l-flags |
| 278 | (cond | 288 | (cond |
| 279 | ((eq file-notify-support 'inotify) '(create modify move delete)) | 289 | ((eq file-notify--library 'inotify) '(create modify move delete)) |
| 280 | ((eq file-notify-support 'w32notify) | 290 | ((eq file-notify--library 'w32notify) |
| 281 | '(file-name directory-name size last-write-time))))) | 291 | '(file-name directory-name size last-write-time))))) |
| 282 | (when (memq 'attribute-change flags) | 292 | (when (memq 'attribute-change flags) |
| 283 | (add-to-list | 293 | (add-to-list |
| 284 | 'l-flags | 294 | 'l-flags |
| 285 | (cond | 295 | (cond |
| 286 | ((eq file-notify-support 'inotify) 'attrib) | 296 | ((eq file-notify--library 'inotify) 'attrib) |
| 287 | ((eq file-notify-support 'w32notify) 'attributes))))) | 297 | ((eq file-notify--library 'w32notify) 'attributes))))) |
| 288 | 298 | ||
| 289 | ;; Call low-level function. | 299 | ;; Call low-level function. |
| 290 | (setq desc (funcall func dir l-flags 'file-notify-callback)))) | 300 | (setq desc (funcall func dir l-flags 'file-notify-callback)))) |
| @@ -311,9 +321,9 @@ DESCRIPTOR should be an object returned by `file-notify-add-watch'." | |||
| 311 | (funcall handler 'file-notify-rm-watch descriptor) | 321 | (funcall handler 'file-notify-rm-watch descriptor) |
| 312 | (funcall | 322 | (funcall |
| 313 | (cond | 323 | (cond |
| 314 | ((eq file-notify-support 'gfilenotify) 'gfile-rm-watch) | 324 | ((eq file-notify--library 'gfilenotify) 'gfile-rm-watch) |
| 315 | ((eq file-notify-support 'inotify) 'inotify-rm-watch) | 325 | ((eq file-notify--library 'inotify) 'inotify-rm-watch) |
| 316 | ((eq file-notify-support 'w32notify) 'w32notify-rm-watch)) | 326 | ((eq file-notify--library 'w32notify) 'w32notify-rm-watch)) |
| 317 | descriptor))) | 327 | descriptor))) |
| 318 | 328 | ||
| 319 | (remhash descriptor file-notify-descriptors))) | 329 | (remhash descriptor file-notify-descriptors))) |
diff --git a/lisp/frame.el b/lisp/frame.el index 3ac24a509a0..ed47afa4b94 100644 --- a/lisp/frame.el +++ b/lisp/frame.el | |||
| @@ -1671,6 +1671,16 @@ left untouched. FRAME nil or omitted means use the selected frame." | |||
| 1671 | :type 'number | 1671 | :type 'number |
| 1672 | :group 'cursor) | 1672 | :group 'cursor) |
| 1673 | 1673 | ||
| 1674 | (defcustom blink-cursor-blinks 10 | ||
| 1675 | "How many times to blink before using a solid cursor on NS and X. | ||
| 1676 | Use 0 or negative value to blink forever." | ||
| 1677 | :version "24.4" | ||
| 1678 | :type 'integer | ||
| 1679 | :group 'cursor) | ||
| 1680 | |||
| 1681 | (defvar blink-cursor-blinks-done 1 | ||
| 1682 | "Number of blinks done since we started blinking on NS and X") | ||
| 1683 | |||
| 1674 | (defvar blink-cursor-idle-timer nil | 1684 | (defvar blink-cursor-idle-timer nil |
| 1675 | "Timer started after `blink-cursor-delay' seconds of Emacs idle time. | 1685 | "Timer started after `blink-cursor-delay' seconds of Emacs idle time. |
| 1676 | The function `blink-cursor-start' is called when the timer fires.") | 1686 | The function `blink-cursor-start' is called when the timer fires.") |
| @@ -1688,6 +1698,7 @@ command starts, by installing a pre-command hook." | |||
| 1688 | (when (null blink-cursor-timer) | 1698 | (when (null blink-cursor-timer) |
| 1689 | ;; Set up the timer first, so that if this signals an error, | 1699 | ;; Set up the timer first, so that if this signals an error, |
| 1690 | ;; blink-cursor-end is not added to pre-command-hook. | 1700 | ;; blink-cursor-end is not added to pre-command-hook. |
| 1701 | (setq blink-cursor-blinks-done 1) | ||
| 1691 | (setq blink-cursor-timer | 1702 | (setq blink-cursor-timer |
| 1692 | (run-with-timer blink-cursor-interval blink-cursor-interval | 1703 | (run-with-timer blink-cursor-interval blink-cursor-interval |
| 1693 | 'blink-cursor-timer-function)) | 1704 | 'blink-cursor-timer-function)) |
| @@ -1696,7 +1707,15 @@ command starts, by installing a pre-command hook." | |||
| 1696 | 1707 | ||
| 1697 | (defun blink-cursor-timer-function () | 1708 | (defun blink-cursor-timer-function () |
| 1698 | "Timer function of timer `blink-cursor-timer'." | 1709 | "Timer function of timer `blink-cursor-timer'." |
| 1699 | (internal-show-cursor nil (not (internal-show-cursor-p)))) | 1710 | (internal-show-cursor nil (not (internal-show-cursor-p))) |
| 1711 | ;; Each blink is two calls to this function. | ||
| 1712 | (when (memq window-system '(x ns w32)) | ||
| 1713 | (setq blink-cursor-blinks-done (1+ blink-cursor-blinks-done)) | ||
| 1714 | (when (and (> blink-cursor-blinks 0) | ||
| 1715 | (<= (* 2 blink-cursor-blinks) blink-cursor-blinks-done)) | ||
| 1716 | (blink-cursor-suspend) | ||
| 1717 | (add-hook 'post-command-hook 'blink-cursor-check)))) | ||
| 1718 | |||
| 1700 | 1719 | ||
| 1701 | (defun blink-cursor-end () | 1720 | (defun blink-cursor-end () |
| 1702 | "Stop cursor blinking. | 1721 | "Stop cursor blinking. |
| @@ -1709,6 +1728,29 @@ itself as a pre-command hook." | |||
| 1709 | (cancel-timer blink-cursor-timer) | 1728 | (cancel-timer blink-cursor-timer) |
| 1710 | (setq blink-cursor-timer nil))) | 1729 | (setq blink-cursor-timer nil))) |
| 1711 | 1730 | ||
| 1731 | (defun blink-cursor-suspend () | ||
| 1732 | "Suspend cursor blinking on NS, X and W32. | ||
| 1733 | This is called when no frame has focus and timers can be suspended. | ||
| 1734 | Timers are restarted by `blink-cursor-check', which is called when a | ||
| 1735 | frame receives focus." | ||
| 1736 | (when (memq window-system '(x ns w32)) | ||
| 1737 | (blink-cursor-end) | ||
| 1738 | (when blink-cursor-idle-timer | ||
| 1739 | (cancel-timer blink-cursor-idle-timer) | ||
| 1740 | (setq blink-cursor-idle-timer nil)))) | ||
| 1741 | |||
| 1742 | (defun blink-cursor-check () | ||
| 1743 | "Check if cursot blinking shall be restarted. | ||
| 1744 | This is done when a frame gets focus. Blink timers may be stopped by | ||
| 1745 | `blink-cursor-suspend'." | ||
| 1746 | (when (and blink-cursor-mode | ||
| 1747 | (not blink-cursor-idle-timer)) | ||
| 1748 | (remove-hook 'post-command-hook 'blink-cursor-check) | ||
| 1749 | (setq blink-cursor-idle-timer | ||
| 1750 | (run-with-idle-timer blink-cursor-delay | ||
| 1751 | blink-cursor-delay | ||
| 1752 | 'blink-cursor-start)))) | ||
| 1753 | |||
| 1712 | (define-obsolete-variable-alias 'blink-cursor 'blink-cursor-mode "22.1") | 1754 | (define-obsolete-variable-alias 'blink-cursor 'blink-cursor-mode "22.1") |
| 1713 | 1755 | ||
| 1714 | (define-minor-mode blink-cursor-mode | 1756 | (define-minor-mode blink-cursor-mode |
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index eade6273e95..4b2892ae4b0 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | 2013-07-19 Geoff Kuenning <geoff@cs.hmc.edu> (tiny change) | ||
| 2 | |||
| 3 | * gnus-art.el (gnus-treat-predicate): Allow functions as predicates | ||
| 4 | (bug#13384). | ||
| 5 | |||
| 6 | 2013-07-18 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 7 | |||
| 8 | * gnus-start.el (gnus-clean-old-newsrc): Remove the newsrc cleanups | ||
| 9 | that were only relevant in a development version a long time ago. | ||
| 10 | |||
| 11 | 2013-07-18 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 12 | |||
| 13 | * gnus-art.el (gnus-shr-put-image): Make it work as well for shr.el's | ||
| 14 | that the old Emacs 24s bundle. | ||
| 15 | |||
| 1 | 2013-07-10 David Engster <deng@randomsample.de> | 16 | 2013-07-10 David Engster <deng@randomsample.de> |
| 2 | 17 | ||
| 3 | * gnus-start.el (gnus-clean-old-newsrc): Always remove 'unexist' marks | 18 | * gnus-start.el (gnus-clean-old-newsrc): Always remove 'unexist' marks |
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index b41ff9c0550..31a108a3c98 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el | |||
| @@ -6197,9 +6197,14 @@ Provided for backwards compatibility." | |||
| 6197 | 6197 | ||
| 6198 | (defun gnus-shr-put-image (data alt &optional flags) | 6198 | (defun gnus-shr-put-image (data alt &optional flags) |
| 6199 | "Put image DATA with a string ALT. Enable image to be deleted." | 6199 | "Put image DATA with a string ALT. Enable image to be deleted." |
| 6200 | (let ((image (shr-put-image data (propertize (or alt "*") | 6200 | (let ((image (if flags |
| 6201 | 'gnus-image-category 'shr) | 6201 | (shr-put-image data (propertize (or alt "*") |
| 6202 | flags))) | 6202 | 'gnus-image-category 'shr) |
| 6203 | flags) | ||
| 6204 | ;; Old `shr-put-image' doesn't take the optional `flags' | ||
| 6205 | ;; argument. | ||
| 6206 | (shr-put-image data (propertize (or alt "*") | ||
| 6207 | 'gnus-image-category 'shr))))) | ||
| 6203 | (when image | 6208 | (when image |
| 6204 | (gnus-add-image 'shr image)))) | 6209 | (gnus-add-image 'shr image)))) |
| 6205 | 6210 | ||
| @@ -8414,6 +8419,8 @@ For example: | |||
| 8414 | (not (gnus-treat-predicate (car val)))) | 8419 | (not (gnus-treat-predicate (car val)))) |
| 8415 | ((eq pred 'typep) | 8420 | ((eq pred 'typep) |
| 8416 | (equal (car val) gnus-treat-type)) | 8421 | (equal (car val) gnus-treat-type)) |
| 8422 | ((functionp pred) | ||
| 8423 | (funcall pred)) | ||
| 8417 | (t | 8424 | (t |
| 8418 | (error "%S is not a valid predicate" pred))))) | 8425 | (error "%S is not a valid predicate" pred))))) |
| 8419 | ((eq val t) | 8426 | ((eq val t) |
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el index 94803800e0b..05cf290cac9 100644 --- a/lisp/gnus/gnus-start.el +++ b/lisp/gnus/gnus-start.el | |||
| @@ -2305,24 +2305,8 @@ If FORCE is non-nil, the .newsrc file is read." | |||
| 2305 | (gnus-clean-old-newsrc)))) | 2305 | (gnus-clean-old-newsrc)))) |
| 2306 | 2306 | ||
| 2307 | (defun gnus-clean-old-newsrc (&optional force) | 2307 | (defun gnus-clean-old-newsrc (&optional force) |
| 2308 | (when gnus-newsrc-file-version | 2308 | ;; Currently no cleanups. |
| 2309 | ;; Remove totally bogus `unexists' entries. The name is | 2309 | ) |
| 2310 | ;; `unexist'. | ||
| 2311 | (dolist (info (cdr gnus-newsrc-alist)) | ||
| 2312 | (let ((exist (assoc 'unexists (gnus-info-marks info)))) | ||
| 2313 | (when exist | ||
| 2314 | (gnus-info-set-marks | ||
| 2315 | info (delete exist (gnus-info-marks info)))))) | ||
| 2316 | (when (or force | ||
| 2317 | (not (string= gnus-newsrc-file-version gnus-version))) | ||
| 2318 | (message (concat "Removing unexist marks because newsrc " | ||
| 2319 | "version does not match Gnus version.")) | ||
| 2320 | ;; Remove old `exist' marks from old nnimap groups. | ||
| 2321 | (dolist (info (cdr gnus-newsrc-alist)) | ||
| 2322 | (let ((exist (assoc 'unexist (gnus-info-marks info)))) | ||
| 2323 | (when exist | ||
| 2324 | (gnus-info-set-marks | ||
| 2325 | info (delete exist (gnus-info-marks info))))))))) | ||
| 2326 | 2310 | ||
| 2327 | (defun gnus-convert-old-newsrc () | 2311 | (defun gnus-convert-old-newsrc () |
| 2328 | "Convert old newsrc formats into the current format, if needed." | 2312 | "Convert old newsrc formats into the current format, if needed." |
diff --git a/lisp/gnus/registry.el b/lisp/gnus/registry.el index 37fe6440743..b056ac5e7f3 100644 --- a/lisp/gnus/registry.el +++ b/lisp/gnus/registry.el | |||
| @@ -228,7 +228,7 @@ With assert non-nil, errors out if the key does not exist already." | |||
| 228 | (let ((entry (gethash key data))) | 228 | (let ((entry (gethash key data))) |
| 229 | (when assert | 229 | (when assert |
| 230 | (assert entry nil | 230 | (assert entry nil |
| 231 | "Key %s does not exists in database" key)) | 231 | "Key %s does not exist in database" key)) |
| 232 | ;; clean entry from the secondary indices | 232 | ;; clean entry from the secondary indices |
| 233 | (dolist (tr tracked) | 233 | (dolist (tr tracked) |
| 234 | ;; is this tracked symbol indexed? | 234 | ;; is this tracked symbol indexed? |
diff --git a/lisp/mail/mailalias.el b/lisp/mail/mailalias.el index c5f1e3921fa..4d9b24e0043 100644 --- a/lisp/mail/mailalias.el +++ b/lisp/mail/mailalias.el | |||
| @@ -209,7 +209,9 @@ removed from alias expansions." | |||
| 209 | (if (re-search-forward "[ \t]*[\n,][ \t]*" end1 t) | 209 | (if (re-search-forward "[ \t]*[\n,][ \t]*" end1 t) |
| 210 | (setq epos (match-beginning 0) | 210 | (setq epos (match-beginning 0) |
| 211 | seplen (- (point) epos)) | 211 | seplen (- (point) epos)) |
| 212 | (setq epos (marker-position end1) seplen 0)) | 212 | ;; Handle the last name in this header field. |
| 213 | ;; We already moved END1 back across whitespace after it. | ||
| 214 | (setq epos (marker-position end1) seplen 0)) | ||
| 213 | (let ((string (buffer-substring-no-properties pos epos)) | 215 | (let ((string (buffer-substring-no-properties pos epos)) |
| 214 | translation) | 216 | translation) |
| 215 | (if (and (not (assoc string disabled-aliases)) | 217 | (if (and (not (assoc string disabled-aliases)) |
diff --git a/lisp/net/eww.el b/lisp/net/eww.el index d832aa7ef3e..d65932ae7c9 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el | |||
| @@ -603,7 +603,7 @@ appears in a <link> or <a> tag." | |||
| 603 | (insert " "))) | 603 | (insert " "))) |
| 604 | 604 | ||
| 605 | (defun eww-process-text-input (beg end length) | 605 | (defun eww-process-text-input (beg end length) |
| 606 | (let* ((form (get-text-property end 'eww-form)) | 606 | (let* ((form (get-text-property (min (1+ end) (point-max)) 'eww-form)) |
| 607 | (properties (text-properties-at end)) | 607 | (properties (text-properties-at end)) |
| 608 | (type (plist-get form :type))) | 608 | (type (plist-get form :type))) |
| 609 | (when (and form | 609 | (when (and form |
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 4506ede8722..6ddf8d2af90 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -143,6 +143,7 @@ cid: URL as the argument.") | |||
| 143 | (define-key map [tab] 'shr-next-link) | 143 | (define-key map [tab] 'shr-next-link) |
| 144 | (define-key map [backtab] 'shr-previous-link) | 144 | (define-key map [backtab] 'shr-previous-link) |
| 145 | (define-key map [follow-link] 'mouse-face) | 145 | (define-key map [follow-link] 'mouse-face) |
| 146 | (define-key map [mouse-2] 'shr-mouse-browse-url) | ||
| 146 | (define-key map "I" 'shr-insert-image) | 147 | (define-key map "I" 'shr-insert-image) |
| 147 | (define-key map "w" 'shr-copy-url) | 148 | (define-key map "w" 'shr-copy-url) |
| 148 | (define-key map "u" 'shr-copy-url) | 149 | (define-key map "u" 'shr-copy-url) |
| @@ -657,6 +658,12 @@ size, and full-buffer size." | |||
| 657 | (forward-line 1) | 658 | (forward-line 1) |
| 658 | (goto-char end)))))) | 659 | (goto-char end)))))) |
| 659 | 660 | ||
| 661 | (defun shr-mouse-browse-url (ev) | ||
| 662 | "Browse the URL under the mouse cursor." | ||
| 663 | (interactive "e") | ||
| 664 | (mouse-set-point ev) | ||
| 665 | (shr-browse-url)) | ||
| 666 | |||
| 660 | (defun shr-browse-url (&optional external) | 667 | (defun shr-browse-url (&optional external) |
| 661 | "Browse the URL under point. | 668 | "Browse the URL under point. |
| 662 | If EXTERNAL, browse the URL using `shr-external-browser'." | 669 | If EXTERNAL, browse the URL using `shr-external-browser'." |
| @@ -1476,9 +1483,6 @@ ones, in case fg and bg are nil." | |||
| 1476 | (if column | 1483 | (if column |
| 1477 | (aref widths width-column) | 1484 | (aref widths width-column) |
| 1478 | 10)) | 1485 | 10)) |
| 1479 | ;; Sanity check for degenerate tables. | ||
| 1480 | (when (zerop width) | ||
| 1481 | (setq width 10)) | ||
| 1482 | (when (and fill | 1486 | (when (and fill |
| 1483 | (setq colspan (cdr (assq :colspan (cdr column))))) | 1487 | (setq colspan (cdr (assq :colspan (cdr column))))) |
| 1484 | (setq colspan (string-to-number colspan)) | 1488 | (setq colspan (string-to-number colspan)) |
| @@ -1491,6 +1495,9 @@ ones, in case fg and bg are nil." | |||
| 1491 | (setq width-column (+ width-column (1- colspan)))) | 1495 | (setq width-column (+ width-column (1- colspan)))) |
| 1492 | (when (or column | 1496 | (when (or column |
| 1493 | (not fill)) | 1497 | (not fill)) |
| 1498 | ;; Sanity check for degenerate tables. | ||
| 1499 | (when (zerop width) | ||
| 1500 | (setq width 10)) | ||
| 1494 | (push (shr-render-td (cdr column) width fill) | 1501 | (push (shr-render-td (cdr column) width fill) |
| 1495 | tds)) | 1502 | tds)) |
| 1496 | (setq i (1+ i) | 1503 | (setq i (1+ i) |
| @@ -1499,6 +1506,7 @@ ones, in case fg and bg are nil." | |||
| 1499 | (nreverse trs))) | 1506 | (nreverse trs))) |
| 1500 | 1507 | ||
| 1501 | (defun shr-render-td (cont width fill) | 1508 | (defun shr-render-td (cont width fill) |
| 1509 | (when (= width 0) (debug)) | ||
| 1502 | (with-temp-buffer | 1510 | (with-temp-buffer |
| 1503 | (let ((bgcolor (cdr (assq :bgcolor cont))) | 1511 | (let ((bgcolor (cdr (assq :bgcolor cont))) |
| 1504 | (fgcolor (cdr (assq :fgcolor cont))) | 1512 | (fgcolor (cdr (assq :fgcolor cont))) |
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 14fb8575fff..56c0ee2dc2d 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -108,6 +108,9 @@ | |||
| 108 | (file-writable-p . tramp-adb-handle-file-writable-p) | 108 | (file-writable-p . tramp-adb-handle-file-writable-p) |
| 109 | (file-local-copy . tramp-adb-handle-file-local-copy) | 109 | (file-local-copy . tramp-adb-handle-file-local-copy) |
| 110 | (file-modes . tramp-handle-file-modes) | 110 | (file-modes . tramp-handle-file-modes) |
| 111 | (file-notify-add-watch . ignore) | ||
| 112 | (file-notify-rm-watch . ignore) | ||
| 113 | (file-notify-supported-p . ignore) | ||
| 111 | (expand-file-name . tramp-adb-handle-expand-file-name) | 114 | (expand-file-name . tramp-adb-handle-expand-file-name) |
| 112 | (find-backup-file-name . tramp-handle-find-backup-file-name) | 115 | (find-backup-file-name . tramp-handle-find-backup-file-name) |
| 113 | (directory-files . tramp-handle-directory-files) | 116 | (directory-files . tramp-handle-directory-files) |
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index d4115352b34..2b0ea74c492 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -184,7 +184,7 @@ | |||
| 184 | 'file-expand-wildcards 'around 'tramp-advice-file-expand-wildcards) | 184 | 'file-expand-wildcards 'around 'tramp-advice-file-expand-wildcards) |
| 185 | (ad-activate 'file-expand-wildcards))))) | 185 | (ad-activate 'file-expand-wildcards))))) |
| 186 | 186 | ||
| 187 | ;; `with-temp-message' does not exists in XEmacs. | 187 | ;; `with-temp-message' does not exist in XEmacs. |
| 188 | (if (fboundp 'with-temp-message) | 188 | (if (fboundp 'with-temp-message) |
| 189 | (defalias 'tramp-compat-with-temp-message 'with-temp-message) | 189 | (defalias 'tramp-compat-with-temp-message 'with-temp-message) |
| 190 | (defmacro tramp-compat-with-temp-message (message &rest body) | 190 | (defmacro tramp-compat-with-temp-message (message &rest body) |
| @@ -292,7 +292,7 @@ Not actually used. Use `(format \"%o\" i)' instead?" | |||
| 292 | (error "Non-octal junk in string `%s'" x)) | 292 | (error "Non-octal junk in string `%s'" x)) |
| 293 | (string-to-number ostr 8))) | 293 | (string-to-number ostr 8))) |
| 294 | 294 | ||
| 295 | ;; ID-FORMAT does not exists in XEmacs. | 295 | ;; ID-FORMAT does not exist in XEmacs. |
| 296 | (defun tramp-compat-file-attributes (filename &optional id-format) | 296 | (defun tramp-compat-file-attributes (filename &optional id-format) |
| 297 | "Like `file-attributes' for Tramp files (compat function)." | 297 | "Like `file-attributes' for Tramp files (compat function)." |
| 298 | (cond | 298 | (cond |
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index c2fdc0491b6..526408140c2 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -435,6 +435,9 @@ Every entry is a list (NAME ADDRESS).") | |||
| 435 | (file-name-nondirectory . tramp-handle-file-name-nondirectory) | 435 | (file-name-nondirectory . tramp-handle-file-name-nondirectory) |
| 436 | ;; `file-name-sans-versions' performed by default handler. | 436 | ;; `file-name-sans-versions' performed by default handler. |
| 437 | (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) | 437 | (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) |
| 438 | (file-notify-add-watch . ignore) | ||
| 439 | (file-notify-rm-watch . ignore) | ||
| 440 | (file-notify-supported-p . ignore) | ||
| 438 | (file-ownership-preserved-p . ignore) | 441 | (file-ownership-preserved-p . ignore) |
| 439 | (file-readable-p . tramp-gvfs-handle-file-readable-p) | 442 | (file-readable-p . tramp-gvfs-handle-file-readable-p) |
| 440 | (file-regular-p . tramp-handle-file-regular-p) | 443 | (file-regular-p . tramp-handle-file-regular-p) |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 281f497692d..d2fc1b9979e 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -867,7 +867,8 @@ of command line.") | |||
| 867 | (set-file-acl . tramp-sh-handle-set-file-acl) | 867 | (set-file-acl . tramp-sh-handle-set-file-acl) |
| 868 | (vc-registered . tramp-sh-handle-vc-registered) | 868 | (vc-registered . tramp-sh-handle-vc-registered) |
| 869 | (file-notify-add-watch . tramp-sh-handle-file-notify-add-watch) | 869 | (file-notify-add-watch . tramp-sh-handle-file-notify-add-watch) |
| 870 | (file-notify-rm-watch . tramp-sh-handle-file-notify-rm-watch)) | 870 | (file-notify-rm-watch . tramp-sh-handle-file-notify-rm-watch) |
| 871 | (file-notify-supported-p . tramp-sh-handle-file-notify-supported-p)) | ||
| 871 | "Alist of handler functions. | 872 | "Alist of handler functions. |
| 872 | Operations not mentioned here will be handled by the normal Emacs functions.") | 873 | Operations not mentioned here will be handled by the normal Emacs functions.") |
| 873 | 874 | ||
| @@ -3334,7 +3335,8 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 3334 | ;; `process-file-side-effects' in order to keep the cache when | 3335 | ;; `process-file-side-effects' in order to keep the cache when |
| 3335 | ;; `process-file' calls appear. | 3336 | ;; `process-file' calls appear. |
| 3336 | (let (process-file-side-effects) | 3337 | (let (process-file-side-effects) |
| 3337 | (tramp-run-real-handler 'vc-registered (list file))))))) | 3338 | (ignore-errors |
| 3339 | (tramp-run-real-handler 'vc-registered (list file)))))))) | ||
| 3338 | 3340 | ||
| 3339 | ;;;###tramp-autoload | 3341 | ;;;###tramp-autoload |
| 3340 | (defun tramp-sh-file-name-handler (operation &rest args) | 3342 | (defun tramp-sh-file-name-handler (operation &rest args) |
| @@ -3497,6 +3499,13 @@ Fall back to normal file name handler if no Tramp handler exists." | |||
| 3497 | (tramp-message proc 6 (format "Kill %S" proc)) | 3499 | (tramp-message proc 6 (format "Kill %S" proc)) |
| 3498 | (kill-process proc)) | 3500 | (kill-process proc)) |
| 3499 | 3501 | ||
| 3502 | (defun tramp-sh-handle-file-notify-supported-p (file-name) | ||
| 3503 | "Like `file-notify-supported-p' for Tramp files." | ||
| 3504 | (with-parsed-tramp-file-name (expand-file-name file-name) nil | ||
| 3505 | (and (or (tramp-get-remote-gvfs-monitor-dir v) | ||
| 3506 | (tramp-get-remote-inotifywait v)) | ||
| 3507 | t))) | ||
| 3508 | |||
| 3500 | ;;; Internal Functions: | 3509 | ;;; Internal Functions: |
| 3501 | 3510 | ||
| 3502 | (defun tramp-maybe-send-script (vec script name) | 3511 | (defun tramp-maybe-send-script (vec script name) |
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 65c52ae4f3c..d9bb5057e7a 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el | |||
| @@ -209,6 +209,9 @@ See `tramp-actions-before-shell' for more info.") | |||
| 209 | (file-name-nondirectory . tramp-handle-file-name-nondirectory) | 209 | (file-name-nondirectory . tramp-handle-file-name-nondirectory) |
| 210 | ;; `file-name-sans-versions' performed by default handler. | 210 | ;; `file-name-sans-versions' performed by default handler. |
| 211 | (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) | 211 | (file-newer-than-file-p . tramp-handle-file-newer-than-file-p) |
| 212 | (file-notify-add-watch . ignore) | ||
| 213 | (file-notify-rm-watch . ignore) | ||
| 214 | (file-notify-supported-p . ignore) | ||
| 212 | (file-ownership-preserved-p . ignore) | 215 | (file-ownership-preserved-p . ignore) |
| 213 | (file-readable-p . tramp-handle-file-exists-p) | 216 | (file-readable-p . tramp-handle-file-exists-p) |
| 214 | (file-regular-p . tramp-handle-file-regular-p) | 217 | (file-regular-p . tramp-handle-file-regular-p) |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 3513701d20e..fd5435bd3d4 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1980,8 +1980,8 @@ ARGS are the arguments OPERATION has been called with." | |||
| 1980 | ;; Emacs 22+ only. | 1980 | ;; Emacs 22+ only. |
| 1981 | 'set-file-times | 1981 | 'set-file-times |
| 1982 | ;; Emacs 24+ only. | 1982 | ;; Emacs 24+ only. |
| 1983 | 'file-acl 'file-notify-add-watch 'file-selinux-context | 1983 | 'file-acl 'file-notify-add-watch 'file-notify-supported-p |
| 1984 | 'set-file-acl 'set-file-selinux-context | 1984 | 'file-selinux-context 'set-file-acl 'set-file-selinux-context |
| 1985 | ;; XEmacs only. | 1985 | ;; XEmacs only. |
| 1986 | 'abbreviate-file-name 'create-file-buffer | 1986 | 'abbreviate-file-name 'create-file-buffer |
| 1987 | 'dired-file-modtime 'dired-make-compressed-filename | 1987 | 'dired-file-modtime 'dired-make-compressed-filename |
diff --git a/lisp/org/org-freemind.el b/lisp/org/org-freemind.el index 3b1c6863f54..2ee58501ca1 100644 --- a/lisp/org/org-freemind.el +++ b/lisp/org/org-freemind.el | |||
| @@ -598,7 +598,7 @@ DRAWERS-REGEXP are converted to freemind notes." | |||
| 598 | 598 | ||
| 599 | (defun org-freemind-check-overwrite (file interactively) | 599 | (defun org-freemind-check-overwrite (file interactively) |
| 600 | "Check if file FILE already exists. | 600 | "Check if file FILE already exists. |
| 601 | If FILE does not exists return t. | 601 | If FILE does not exist return t. |
| 602 | 602 | ||
| 603 | If INTERACTIVELY is non-nil ask if the file should be replaced | 603 | If INTERACTIVELY is non-nil ask if the file should be replaced |
| 604 | and return t/nil if it should/should not be replaced. | 604 | and return t/nil if it should/should not be replaced. |
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 0b83921504b..c8fae7ba1e6 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -46,11 +46,6 @@ | |||
| 46 | :prefix "ruby-" | 46 | :prefix "ruby-" |
| 47 | :group 'languages) | 47 | :group 'languages) |
| 48 | 48 | ||
| 49 | (defconst ruby-keyword-end-re | ||
| 50 | (if (string-match "\\_>" "ruby") | ||
| 51 | "\\_>" | ||
| 52 | "\\>")) | ||
| 53 | |||
| 54 | (defconst ruby-block-beg-keywords | 49 | (defconst ruby-block-beg-keywords |
| 55 | '("class" "module" "def" "if" "unless" "case" "while" "until" "for" "begin" "do") | 50 | '("class" "module" "def" "if" "unless" "case" "while" "until" "for" "begin" "do") |
| 56 | "Keywords at the beginning of blocks.") | 51 | "Keywords at the beginning of blocks.") |
| @@ -60,7 +55,7 @@ | |||
| 60 | "Regexp to match the beginning of blocks.") | 55 | "Regexp to match the beginning of blocks.") |
| 61 | 56 | ||
| 62 | (defconst ruby-non-block-do-re | 57 | (defconst ruby-non-block-do-re |
| 63 | (concat (regexp-opt '("while" "until" "for" "rescue") t) ruby-keyword-end-re) | 58 | (regexp-opt '("while" "until" "for" "rescue") 'symbols) |
| 64 | "Regexp to match keywords that nest without blocks.") | 59 | "Regexp to match keywords that nest without blocks.") |
| 65 | 60 | ||
| 66 | (defconst ruby-indent-beg-re | 61 | (defconst ruby-indent-beg-re |
| @@ -696,7 +691,7 @@ Can be one of `heredoc', `modifier', `expr-qstr', `expr-re'." | |||
| 696 | ((looking-at (concat "\\_<\\(" ruby-block-beg-re "\\)\\_>")) | 691 | ((looking-at (concat "\\_<\\(" ruby-block-beg-re "\\)\\_>")) |
| 697 | (and | 692 | (and |
| 698 | (save-match-data | 693 | (save-match-data |
| 699 | (or (not (looking-at (concat "do" ruby-keyword-end-re))) | 694 | (or (not (looking-at "do\\_>")) |
| 700 | (save-excursion | 695 | (save-excursion |
| 701 | (back-to-indentation) | 696 | (back-to-indentation) |
| 702 | (not (looking-at ruby-non-block-do-re))))) | 697 | (not (looking-at ruby-non-block-do-re))))) |
| @@ -1718,14 +1713,16 @@ See the definition of `ruby-font-lock-syntactic-keywords'." | |||
| 1718 | "The syntax table to use for fontifying Ruby mode buffers. | 1713 | "The syntax table to use for fontifying Ruby mode buffers. |
| 1719 | See `font-lock-syntax-table'.") | 1714 | See `font-lock-syntax-table'.") |
| 1720 | 1715 | ||
| 1716 | (defconst ruby-font-lock-keyword-beg-re "\\(?:^\\|[^.@$]\\|\\.\\.\\)") | ||
| 1717 | |||
| 1721 | (defconst ruby-font-lock-keywords | 1718 | (defconst ruby-font-lock-keywords |
| 1722 | (list | 1719 | (list |
| 1723 | ;; functions | 1720 | ;; functions |
| 1724 | '("^\\s *def\\s +\\(?:[^( \t\n.]*\\.\\)?\\([^( \t\n]+\\)" | 1721 | '("^\\s *def\\s +\\(?:[^( \t\n.]*\\.\\)?\\([^( \t\n]+\\)" |
| 1725 | 1 font-lock-function-name-face) | 1722 | 1 font-lock-function-name-face) |
| 1723 | ;; keywords | ||
| 1726 | (list (concat | 1724 | (list (concat |
| 1727 | "\\(^\\|[^.@$]\\|\\.\\.\\)\\(" | 1725 | ruby-font-lock-keyword-beg-re |
| 1728 | ;; keywords | ||
| 1729 | (regexp-opt | 1726 | (regexp-opt |
| 1730 | '("alias" | 1727 | '("alias" |
| 1731 | "and" | 1728 | "and" |
| @@ -1760,11 +1757,14 @@ See `font-lock-syntax-table'.") | |||
| 1760 | "when" | 1757 | "when" |
| 1761 | "while" | 1758 | "while" |
| 1762 | "yield") | 1759 | "yield") |
| 1763 | 'symbols) | 1760 | 'symbols)) |
| 1764 | "\\|" | 1761 | 1 'font-lock-keyword-face) |
| 1762 | ;; some core methods | ||
| 1763 | (list (concat | ||
| 1764 | ruby-font-lock-keyword-beg-re | ||
| 1765 | (regexp-opt | 1765 | (regexp-opt |
| 1766 | ;; built-in methods on Kernel | 1766 | '(;; built-in methods on Kernel |
| 1767 | '("__callee__" | 1767 | "__callee__" |
| 1768 | "__dir__" | 1768 | "__dir__" |
| 1769 | "__method__" | 1769 | "__method__" |
| 1770 | "abort" | 1770 | "abort" |
| @@ -1823,20 +1823,17 @@ See `font-lock-syntax-table'.") | |||
| 1823 | "public" | 1823 | "public" |
| 1824 | "refine" | 1824 | "refine" |
| 1825 | "using") | 1825 | "using") |
| 1826 | 'symbols) | 1826 | 'symbols)) |
| 1827 | "\\)") | 1827 | 1 'font-lock-builtin-face) |
| 1828 | 2 | ||
| 1829 | '(if (match-beginning 4) | ||
| 1830 | font-lock-builtin-face | ||
| 1831 | font-lock-keyword-face)) | ||
| 1832 | ;; Perl-ish keywords | 1828 | ;; Perl-ish keywords |
| 1833 | "\\_<\\(?:BEGIN\\|END\\)\\_>\\|^__END__$" | 1829 | "\\_<\\(?:BEGIN\\|END\\)\\_>\\|^__END__$" |
| 1834 | ;; here-doc beginnings | 1830 | ;; here-doc beginnings |
| 1835 | `(,ruby-here-doc-beg-re 0 (unless (ruby-singleton-class-p (match-beginning 0)) | 1831 | `(,ruby-here-doc-beg-re 0 (unless (ruby-singleton-class-p (match-beginning 0)) |
| 1836 | 'font-lock-string-face)) | 1832 | 'font-lock-string-face)) |
| 1837 | ;; variables | 1833 | ;; variables |
| 1838 | '("\\(^\\|[^.@$]\\|\\.\\.\\)\\_<\\(nil\\|self\\|true\\|false\\)\\>" | 1834 | `(,(concat ruby-font-lock-keyword-beg-re |
| 1839 | 2 font-lock-variable-name-face) | 1835 | "\\_<\\(nil\\|self\\|true\\|false\\)\\>") |
| 1836 | 1 font-lock-variable-name-face) | ||
| 1840 | ;; keywords that evaluate to certain values | 1837 | ;; keywords that evaluate to certain values |
| 1841 | '("\\_<__\\(?:LINE\\|ENCODING\\|FILE\\)__\\_>" 0 font-lock-variable-name-face) | 1838 | '("\\_<__\\(?:LINE\\|ENCODING\\|FILE\\)__\\_>" 0 font-lock-variable-name-face) |
| 1842 | ;; symbols | 1839 | ;; symbols |
| @@ -1852,7 +1849,7 @@ See `font-lock-syntax-table'.") | |||
| 1852 | 1 (unless (eq ?\( (char-after)) font-lock-type-face)) | 1849 | 1 (unless (eq ?\( (char-after)) font-lock-type-face)) |
| 1853 | '("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]" 2 font-lock-constant-face) | 1850 | '("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]" 2 font-lock-constant-face) |
| 1854 | ;; conversion methods on Kernel | 1851 | ;; conversion methods on Kernel |
| 1855 | (list (concat "\\(?:^\\|[^.@$]\\|\\.\\.\\)" | 1852 | (list (concat ruby-font-lock-keyword-beg-re |
| 1856 | (regexp-opt '("Array" "Complex" "Float" "Hash" | 1853 | (regexp-opt '("Array" "Complex" "Float" "Hash" |
| 1857 | "Integer" "Rational" "String") 'symbols)) | 1854 | "Integer" "Rational" "String") 'symbols)) |
| 1858 | 1 font-lock-builtin-face) | 1855 | 1 font-lock-builtin-face) |
| @@ -1864,7 +1861,7 @@ See `font-lock-syntax-table'.") | |||
| 1864 | 1 font-lock-negation-char-face) | 1861 | 1 font-lock-negation-char-face) |
| 1865 | ;; character literals | 1862 | ;; character literals |
| 1866 | ;; FIXME: Support longer escape sequences. | 1863 | ;; FIXME: Support longer escape sequences. |
| 1867 | '("\\?\\\\?\\S " 0 font-lock-string-face) | 1864 | '("\\_<\\?\\\\?\\S " 0 font-lock-string-face) |
| 1868 | ) | 1865 | ) |
| 1869 | "Additional expressions to highlight in Ruby mode.") | 1866 | "Additional expressions to highlight in Ruby mode.") |
| 1870 | 1867 | ||
diff --git a/lisp/shell.el b/lisp/shell.el index 51a0ffc4fe8..a78ab7f81ab 100644 --- a/lisp/shell.el +++ b/lisp/shell.el | |||
| @@ -284,21 +284,9 @@ Value is a list of strings, which may be nil." | |||
| 284 | ;; Note: There are no explicit references to the variable `explicit-bash-args'. | 284 | ;; Note: There are no explicit references to the variable `explicit-bash-args'. |
| 285 | ;; It is used implicitly by M-x shell when the interactive shell is `bash'. | 285 | ;; It is used implicitly by M-x shell when the interactive shell is `bash'. |
| 286 | (defcustom explicit-bash-args | 286 | (defcustom explicit-bash-args |
| 287 | (let* ((prog (or (and (boundp 'explicit-shell-file-name) explicit-shell-file-name) | 287 | ;; Tell bash not to use readline. It's safe to assume --noediting now, |
| 288 | (getenv "ESHELL") shell-file-name)) | 288 | ;; as it was introduced in 1996 in Bash version 2. |
| 289 | (name (file-name-nondirectory prog))) | 289 | '("--noediting" "-i") |
| 290 | ;; Tell bash not to use readline, except for bash 1.x which | ||
| 291 | ;; doesn't grok --noediting. Bash 1.x has -nolineediting, but | ||
| 292 | ;; process-send-eof cannot terminate bash if we use it. | ||
| 293 | (if (and (not purify-flag) | ||
| 294 | (equal name "bash") | ||
| 295 | (file-executable-p prog) | ||
| 296 | (string-match "bad option" | ||
| 297 | (shell-command-to-string | ||
| 298 | (concat (shell-quote-argument prog) | ||
| 299 | " --noediting")))) | ||
| 300 | '("-i") | ||
| 301 | '("--noediting" "-i"))) | ||
| 302 | "Args passed to inferior shell by \\[shell], if the shell is bash. | 290 | "Args passed to inferior shell by \\[shell], if the shell is bash. |
| 303 | Value is a list of strings, which may be nil." | 291 | Value is a list of strings, which may be nil." |
| 304 | :type '(repeat (string :tag "Argument")) | 292 | :type '(repeat (string :tag "Argument")) |
diff --git a/lisp/simple.el b/lisp/simple.el index 3e3ff485c5e..4b158d31f36 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -4800,6 +4800,8 @@ The value is a floating-point number." | |||
| 4800 | (this-ypos (nth 2 this-lh)) | 4800 | (this-ypos (nth 2 this-lh)) |
| 4801 | (dlh (default-line-height)) | 4801 | (dlh (default-line-height)) |
| 4802 | (wslines (window-screen-lines)) | 4802 | (wslines (window-screen-lines)) |
| 4803 | (edges (window-inside-pixel-edges)) | ||
| 4804 | (winh (- (nth 3 edges) (nth 1 edges) 1)) | ||
| 4803 | py vs last-line) | 4805 | py vs last-line) |
| 4804 | (if (> (mod wslines 1.0) 0.0) | 4806 | (if (> (mod wslines 1.0) 0.0) |
| 4805 | (setq wslines (round (+ wslines 0.5)))) | 4807 | (setq wslines (round (+ wslines 0.5)))) |
| @@ -4848,7 +4850,7 @@ The value is a floating-point number." | |||
| 4848 | nil) | 4850 | nil) |
| 4849 | ;; If cursor is not in the bottom scroll margin, and the | 4851 | ;; If cursor is not in the bottom scroll margin, and the |
| 4850 | ;; current line is is not too tall, move forward. | 4852 | ;; current line is is not too tall, move forward. |
| 4851 | ((and (or (null this-height) (<= this-height dlh)) | 4853 | ((and (or (null this-height) (<= this-height winh)) |
| 4852 | vpos | 4854 | vpos |
| 4853 | (> vpos 0) | 4855 | (> vpos 0) |
| 4854 | (< py last-line)) | 4856 | (< py last-line)) |
| @@ -4865,7 +4867,7 @@ The value is a floating-point number." | |||
| 4865 | (> vpos 0) | 4867 | (> vpos 0) |
| 4866 | (= py last-line)) | 4868 | (= py last-line)) |
| 4867 | ;; Don't vscroll if the partially-visible line at window | 4869 | ;; Don't vscroll if the partially-visible line at window |
| 4868 | ;; bottom has the default height (a.k.a. "just one more text | 4870 | ;; bottom is not too tall (a.k.a. "just one more text |
| 4869 | ;; line"): in that case, we do want redisplay to behave | 4871 | ;; line"): in that case, we do want redisplay to behave |
| 4870 | ;; normally, i.e. recenter or whatever. | 4872 | ;; normally, i.e. recenter or whatever. |
| 4871 | ;; | 4873 | ;; |
| @@ -4874,7 +4876,7 @@ The value is a floating-point number." | |||
| 4874 | ;; partially-visible glyph row at the end of the window. As | 4876 | ;; partially-visible glyph row at the end of the window. As |
| 4875 | ;; we are dealing with floats, we disregard sub-pixel | 4877 | ;; we are dealing with floats, we disregard sub-pixel |
| 4876 | ;; discrepancies between that and DLH. | 4878 | ;; discrepancies between that and DLH. |
| 4877 | (if (and rowh rbot (>= (- (+ rowh rbot) dlh) 1)) | 4879 | (if (and rowh rbot (>= (- (+ rowh rbot) winh) 1)) |
| 4878 | (set-window-vscroll nil dlh t)) | 4880 | (set-window-vscroll nil dlh t)) |
| 4879 | (line-move-1 arg noerror to-end) | 4881 | (line-move-1 arg noerror to-end) |
| 4880 | t) | 4882 | t) |
| @@ -4918,10 +4920,13 @@ The value is a floating-point number." | |||
| 4918 | ;; If we moved into a tall line, set vscroll to make | 4920 | ;; If we moved into a tall line, set vscroll to make |
| 4919 | ;; scrolling through tall images more smooth. | 4921 | ;; scrolling through tall images more smooth. |
| 4920 | (let ((lh (line-pixel-height)) | 4922 | (let ((lh (line-pixel-height)) |
| 4921 | (dlh (default-line-height))) | 4923 | (edges (window-inside-pixel-edges)) |
| 4924 | (dlh (default-line-height)) | ||
| 4925 | winh) | ||
| 4926 | (setq winh (- (nth 3 edges) (nth 1 edges) 1)) | ||
| 4922 | (if (and (< arg 0) | 4927 | (if (and (< arg 0) |
| 4923 | (< (point) (window-start)) | 4928 | (< (point) (window-start)) |
| 4924 | (> lh dlh)) | 4929 | (> lh winh)) |
| 4925 | (set-window-vscroll | 4930 | (set-window-vscroll |
| 4926 | nil | 4931 | nil |
| 4927 | (- lh dlh) t)))) | 4932 | (- lh dlh) t)))) |
| @@ -7437,19 +7442,19 @@ warning using STRING as the message.") | |||
| 7437 | 7442 | ||
| 7438 | ;;; Generic dispatcher commands | 7443 | ;;; Generic dispatcher commands |
| 7439 | 7444 | ||
| 7440 | ;; Macro `alternatives-define' is used to create generic commands. | 7445 | ;; Macro `define-alternatives' is used to create generic commands. |
| 7441 | ;; Generic commands are these (like web, mail, news, encrypt, irc, etc.) | 7446 | ;; Generic commands are these (like web, mail, news, encrypt, irc, etc.) |
| 7442 | ;; that can have different alternative implementations where choosing | 7447 | ;; that can have different alternative implementations where choosing |
| 7443 | ;; among them is exclusively a matter of user preference. | 7448 | ;; among them is exclusively a matter of user preference. |
| 7444 | 7449 | ||
| 7445 | ;; (alternatives-define COMMAND) creates a new interactive command | 7450 | ;; (define-alternatives COMMAND) creates a new interactive command |
| 7446 | ;; M-x COMMAND and a customizable variable COMMAND-alternatives. | 7451 | ;; M-x COMMAND and a customizable variable COMMAND-alternatives. |
| 7447 | ;; Typically, the user will not need to customize this variable; packages | 7452 | ;; Typically, the user will not need to customize this variable; packages |
| 7448 | ;; wanting to add alternative implementations should use | 7453 | ;; wanting to add alternative implementations should use |
| 7449 | ;; | 7454 | ;; |
| 7450 | ;; ;;;###autoload (push '("My impl name" . my-impl-symbol) COMMAND-alternatives | 7455 | ;; ;;;###autoload (push '("My impl name" . my-impl-symbol) COMMAND-alternatives |
| 7451 | 7456 | ||
| 7452 | (defmacro alternatives-define (command &rest customizations) | 7457 | (defmacro define-alternatives (command &rest customizations) |
| 7453 | "Define new command `COMMAND'. | 7458 | "Define new command `COMMAND'. |
| 7454 | The variable `COMMAND-alternatives' will contain alternative | 7459 | The variable `COMMAND-alternatives' will contain alternative |
| 7455 | implementations of COMMAND, so that running `C-u M-x COMMAND' | 7460 | implementations of COMMAND, so that running `C-u M-x COMMAND' |
diff --git a/lisp/subr.el b/lisp/subr.el index b6ee96f879e..75c6b3a0620 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -3529,7 +3529,7 @@ likely to have undesired semantics.") | |||
| 3529 | ;; defaulted, OMIT-NULLS should be treated as t. Simplifying the logical | 3529 | ;; defaulted, OMIT-NULLS should be treated as t. Simplifying the logical |
| 3530 | ;; expression leads to the equivalent implementation that if SEPARATORS | 3530 | ;; expression leads to the equivalent implementation that if SEPARATORS |
| 3531 | ;; is defaulted, OMIT-NULLS is treated as t. | 3531 | ;; is defaulted, OMIT-NULLS is treated as t. |
| 3532 | (defun split-string (string &optional separators omit-nulls) | 3532 | (defun split-string (string &optional separators omit-nulls trim) |
| 3533 | "Split STRING into substrings bounded by matches for SEPARATORS. | 3533 | "Split STRING into substrings bounded by matches for SEPARATORS. |
| 3534 | 3534 | ||
| 3535 | The beginning and end of STRING, and each match for SEPARATORS, are | 3535 | The beginning and end of STRING, and each match for SEPARATORS, are |
| @@ -3547,17 +3547,50 @@ that for the default value of SEPARATORS leading and trailing whitespace | |||
| 3547 | are effectively trimmed). If nil, all zero-length substrings are retained, | 3547 | are effectively trimmed). If nil, all zero-length substrings are retained, |
| 3548 | which correctly parses CSV format, for example. | 3548 | which correctly parses CSV format, for example. |
| 3549 | 3549 | ||
| 3550 | If TRIM is non-nil, it should be a regular expression to match | ||
| 3551 | text to trim from the beginning and end of each substring. If trimming | ||
| 3552 | makes the substring empty, it is treated as null. | ||
| 3553 | |||
| 3554 | If you want to trim whitespace from the substrings, the reliably correct | ||
| 3555 | way is using TRIM. Making SEPARATORS match that whitespace gives incorrect | ||
| 3556 | results when there is whitespace at the start or end of STRING. If you | ||
| 3557 | see such calls to `split-string', please fix them. | ||
| 3558 | |||
| 3550 | Note that the effect of `(split-string STRING)' is the same as | 3559 | Note that the effect of `(split-string STRING)' is the same as |
| 3551 | `(split-string STRING split-string-default-separators t)'. In the rare | 3560 | `(split-string STRING split-string-default-separators t)'. In the rare |
| 3552 | case that you wish to retain zero-length substrings when splitting on | 3561 | case that you wish to retain zero-length substrings when splitting on |
| 3553 | whitespace, use `(split-string STRING split-string-default-separators)'. | 3562 | whitespace, use `(split-string STRING split-string-default-separators)'. |
| 3554 | 3563 | ||
| 3555 | Modifies the match data; use `save-match-data' if necessary." | 3564 | Modifies the match data; use `save-match-data' if necessary." |
| 3556 | (let ((keep-nulls (not (if separators omit-nulls t))) | 3565 | (let* ((keep-nulls (not (if separators omit-nulls t))) |
| 3557 | (rexp (or separators split-string-default-separators)) | 3566 | (rexp (or separators split-string-default-separators)) |
| 3558 | (start 0) | 3567 | (start 0) |
| 3559 | notfirst | 3568 | this-start this-end |
| 3560 | (list nil)) | 3569 | notfirst |
| 3570 | (list nil) | ||
| 3571 | (push-one | ||
| 3572 | ;; Push the substring in range THIS-START to THIS-END | ||
| 3573 | ;; onto LIST, trimming it and perhaps discarding it. | ||
| 3574 | (lambda () | ||
| 3575 | (when trim | ||
| 3576 | ;; Discard the trim from start of this substring. | ||
| 3577 | (let ((tem (string-match trim string this-start))) | ||
| 3578 | (and (eq tem this-start) | ||
| 3579 | (setq this-start (match-end 0))))) | ||
| 3580 | |||
| 3581 | (when (or keep-nulls (< this-start this-end)) | ||
| 3582 | (let ((this (substring string this-start this-end))) | ||
| 3583 | |||
| 3584 | ;; Discard the trim from end of this substring. | ||
| 3585 | (when trim | ||
| 3586 | (let ((tem (string-match (concat trim "\\'") this 0))) | ||
| 3587 | (and tem (< tem (length this)) | ||
| 3588 | (setq this (substring this 0 tem))))) | ||
| 3589 | |||
| 3590 | ;; Trimming could make it empty; check again. | ||
| 3591 | (when (or keep-nulls (> (length this) 0)) | ||
| 3592 | (push this list))))))) | ||
| 3593 | |||
| 3561 | (while (and (string-match rexp string | 3594 | (while (and (string-match rexp string |
| 3562 | (if (and notfirst | 3595 | (if (and notfirst |
| 3563 | (= start (match-beginning 0)) | 3596 | (= start (match-beginning 0)) |
| @@ -3565,15 +3598,15 @@ Modifies the match data; use `save-match-data' if necessary." | |||
| 3565 | (1+ start) start)) | 3598 | (1+ start) start)) |
| 3566 | (< start (length string))) | 3599 | (< start (length string))) |
| 3567 | (setq notfirst t) | 3600 | (setq notfirst t) |
| 3568 | (if (or keep-nulls (< start (match-beginning 0))) | 3601 | (setq this-start start this-end (match-beginning 0) |
| 3569 | (setq list | 3602 | start (match-end 0)) |
| 3570 | (cons (substring string start (match-beginning 0)) | 3603 | |
| 3571 | list))) | 3604 | (funcall push-one)) |
| 3572 | (setq start (match-end 0))) | 3605 | |
| 3573 | (if (or keep-nulls (< start (length string))) | 3606 | ;; Handle the substring at the end of STRING. |
| 3574 | (setq list | 3607 | (setq this-start start this-end (length string)) |
| 3575 | (cons (substring string start) | 3608 | (funcall push-one) |
| 3576 | list))) | 3609 | |
| 3577 | (nreverse list))) | 3610 | (nreverse list))) |
| 3578 | 3611 | ||
| 3579 | (defun combine-and-quote-strings (strings &optional separator) | 3612 | (defun combine-and-quote-strings (strings &optional separator) |