diff options
| author | Juanma Barranquero | 2013-08-06 03:26:29 +0200 |
|---|---|---|
| committer | Juanma Barranquero | 2013-08-06 03:26:29 +0200 |
| commit | 307764cc3a2afd363cae0a36a6d18dfa68788cb4 (patch) | |
| tree | 5eba8c009db5f4ba16eb188aa0124b7ee832bffd /lisp | |
| parent | 1d237bbae7fe9bb69708760abc9ae435513a0465 (diff) | |
| download | emacs-307764cc3a2afd363cae0a36a6d18dfa68788cb4.tar.gz emacs-307764cc3a2afd363cae0a36a6d18dfa68788cb4.zip | |
lisp/frameset.el: Various fixes.
(frameset-p): Don't check non-nullness of the `properties'
slot , which can indeed be nil.
(frameset-live-filter-alist, frameset-persistent-filter-alist):
Move entry for `left' from persistent to live filter alist.
(frameset-filter-alist, frameset--minibufferless-last-p, frameset-save):
Doc fixes.
(frameset-filter-params): When restoring a frame, copy items added to
`filtered', to avoid unwittingly modifying the original parameters.
(frameset-move-onscreen): Rename from frameset--move-onscreen. Doc fix.
(frameset--restore-frame): Fix reference to frameset-move-onscreen.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/frameset.el | 34 |
2 files changed, 31 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c3f908b83ae..61254731938 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,16 @@ | |||
| 1 | 2013-08-06 Juanma Barranquero <lekktu@gmail.com> | 1 | 2013-08-06 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 2 | ||
| 3 | * frameset.el (frameset-p): Don't check non-nullness of the `properties' | ||
| 4 | slot , which can indeed be nil. | ||
| 5 | (frameset-live-filter-alist, frameset-persistent-filter-alist): | ||
| 6 | Move entry for `left' from persistent to live filter alist. | ||
| 7 | (frameset-filter-alist, frameset--minibufferless-last-p, frameset-save): | ||
| 8 | Doc fixes. | ||
| 9 | (frameset-filter-params): When restoring a frame, copy items added to | ||
| 10 | `filtered', to avoid unwittingly modifying the original parameters. | ||
| 11 | (frameset-move-onscreen): Rename from frameset--move-onscreen. Doc fix. | ||
| 12 | (frameset--restore-frame): Fix reference to frameset-move-onscreen. | ||
| 13 | |||
| 3 | * dired.el (dired-insert-directory): Revert change in 2013-06-21T12:24:37Z!lekktu@gmail.com | 14 | * dired.el (dired-insert-directory): Revert change in 2013-06-21T12:24:37Z!lekktu@gmail.com |
| 4 | to use looking-at-p instead of looking-at. (Bug#15028) | 15 | to use looking-at-p instead of looking-at. (Bug#15028) |
| 5 | 16 | ||
diff --git a/lisp/frameset.el b/lisp/frameset.el index 0e98f4655da..71c26112917 100644 --- a/lisp/frameset.el +++ b/lisp/frameset.el | |||
| @@ -103,7 +103,6 @@ This is a deep copy done with `copy-tree'." | |||
| 103 | Else return nil." | 103 | Else return nil." |
| 104 | (and (eq (car-safe frameset) 'frameset) ; is a list | 104 | (and (eq (car-safe frameset) 'frameset) ; is a list |
| 105 | (integerp (nth 1 frameset)) ; version is an int | 105 | (integerp (nth 1 frameset)) ; version is an int |
| 106 | (nth 2 frameset) ; properties is non-null | ||
| 107 | (nth 3 frameset) ; states is non-null | 106 | (nth 3 frameset) ; states is non-null |
| 108 | (nth 1 frameset))) ; return version | 107 | (nth 1 frameset))) ; return version |
| 109 | 108 | ||
| @@ -129,6 +128,7 @@ Properties can be set with | |||
| 129 | ;;;###autoload | 128 | ;;;###autoload |
| 130 | (defvar frameset-live-filter-alist | 129 | (defvar frameset-live-filter-alist |
| 131 | '((name . :never) | 130 | '((name . :never) |
| 131 | (left . frameset-filter-iconified) | ||
| 132 | (minibuffer . frameset-filter-minibuffer) | 132 | (minibuffer . frameset-filter-minibuffer) |
| 133 | (top . frameset-filter-iconified)) | 133 | (top . frameset-filter-iconified)) |
| 134 | "Minimum set of parameters to filter for live (on-session) framesets. | 134 | "Minimum set of parameters to filter for live (on-session) framesets. |
| @@ -149,7 +149,6 @@ See `frameset-filter-alist' for a full description.") | |||
| 149 | (GUI:height . frameset-filter-restore-param) | 149 | (GUI:height . frameset-filter-restore-param) |
| 150 | (GUI:width . frameset-filter-restore-param) | 150 | (GUI:width . frameset-filter-restore-param) |
| 151 | (height . frameset-filter-save-param) | 151 | (height . frameset-filter-save-param) |
| 152 | (left . frameset-filter-iconified) | ||
| 153 | (outer-window-id . :never) | 152 | (outer-window-id . :never) |
| 154 | (parent-id . :never) | 153 | (parent-id . :never) |
| 155 | (tty . frameset-filter-tty-to-GUI) | 154 | (tty . frameset-filter-tty-to-GUI) |
| @@ -194,7 +193,8 @@ SAVING, plus any additional ARGS: | |||
| 194 | SAVING Non-nil if filtering before saving state, nil if filtering | 193 | SAVING Non-nil if filtering before saving state, nil if filtering |
| 195 | before restoring it. | 194 | before restoring it. |
| 196 | 195 | ||
| 197 | FILTER-FUN must return: | 196 | FILTER-FUN is allowed to modify items in FILTERED, but no other arguments. |
| 197 | It must return: | ||
| 198 | nil Skip CURRENT (do not add it to FILTERED). | 198 | nil Skip CURRENT (do not add it to FILTERED). |
| 199 | t Add CURRENT to FILTERED as is. | 199 | t Add CURRENT to FILTERED as is. |
| 200 | (NEW-PARAM . NEW-VALUE) Add this to FILTERED instead of CURRENT. | 200 | (NEW-PARAM . NEW-VALUE) Add this to FILTERED instead of CURRENT. |
| @@ -315,19 +315,24 @@ SAVING is non-nil while filtering parameters to save a frameset, | |||
| 315 | nil while the filtering is done to restore it." | 315 | nil while the filtering is done to restore it." |
| 316 | (let ((filtered nil)) | 316 | (let ((filtered nil)) |
| 317 | (dolist (current parameters) | 317 | (dolist (current parameters) |
| 318 | ;; When saving, the parameter list is temporary, so modifying it | ||
| 319 | ;; is not a problem. When restoring, the parameter list is part | ||
| 320 | ;; of a frameset, so we must copy parameters to avoid inadvertent | ||
| 321 | ;; modifications. | ||
| 318 | (pcase (cdr (assq (car current) filter-alist)) | 322 | (pcase (cdr (assq (car current) filter-alist)) |
| 319 | (`nil | 323 | (`nil |
| 320 | (push current filtered)) | 324 | (push (if saving current (copy-tree current)) filtered)) |
| 321 | (:never | 325 | (:never |
| 322 | nil) | 326 | nil) |
| 323 | (:restore | 327 | (:restore |
| 324 | (unless saving (push current filtered))) | 328 | (unless saving (push (copy-tree current) filtered))) |
| 325 | (:save | 329 | (:save |
| 326 | (when saving (push current filtered))) | 330 | (when saving (push current filtered))) |
| 327 | ((or `(,fun . ,args) (and fun (pred fboundp))) | 331 | ((or `(,fun . ,args) (and fun (pred fboundp))) |
| 328 | (let ((this (apply fun current filtered parameters saving args))) | 332 | (let* ((this (apply fun current filtered parameters saving args)) |
| 329 | (when this | 333 | (val (if (eq this t) current this))) |
| 330 | (push (if (eq this t) current this) filtered)))) | 334 | (when val |
| 335 | (push (if saving val (copy-tree val)) filtered)))) | ||
| 331 | (other | 336 | (other |
| 332 | (delay-warning 'frameset (format "Unknown filter %S" other) :error)))) | 337 | (delay-warning 'frameset (format "Unknown filter %S" other) :error)))) |
| 333 | ;; Set the display parameter after filtering, so that filter functions | 338 | ;; Set the display parameter after filtering, so that filter functions |
| @@ -410,7 +415,8 @@ FRAME-LIST is a list of frames. Internal use only." | |||
| 410 | ;;;###autoload | 415 | ;;;###autoload |
| 411 | (cl-defun frameset-save (frame-list &key filters predicate properties) | 416 | (cl-defun frameset-save (frame-list &key filters predicate properties) |
| 412 | "Return the frameset of FRAME-LIST, a list of frames. | 417 | "Return the frameset of FRAME-LIST, a list of frames. |
| 413 | If nil, FRAME-LIST defaults to all live frames. | 418 | Dead frames and non-frame objects are silently removed from the list. |
| 419 | If nil, FRAME-LIST defaults to the output of `frame-list' (all live frames). | ||
| 414 | FILTERS is an alist of parameter filters; defaults to `frameset-filter-alist'. | 420 | FILTERS is an alist of parameter filters; defaults to `frameset-filter-alist'. |
| 415 | PREDICATE is a predicate function, which must return non-nil for frames that | 421 | PREDICATE is a predicate function, which must return non-nil for frames that |
| 416 | should be saved; it defaults to saving all frames from FRAME-LIST. | 422 | should be saved; it defaults to saving all frames from FRAME-LIST. |
| @@ -445,12 +451,12 @@ Internal use only.") | |||
| 445 | (`(- ,val) (+ right/bottom val)) | 451 | (`(- ,val) (+ right/bottom val)) |
| 446 | (val val))) | 452 | (val val))) |
| 447 | 453 | ||
| 448 | (defun frameset--move-onscreen (frame force-onscreen) | 454 | (defun frameset-move-onscreen (frame force-onscreen) |
| 449 | "If FRAME is offscreen, move it back onscreen and, if necessary, resize it. | 455 | "If FRAME is offscreen, move it back onscreen and, if necessary, resize it. |
| 450 | For the description of FORCE-ONSCREEN, see `frameset-restore'. | 456 | For the description of FORCE-ONSCREEN, see `frameset-restore'. |
| 451 | When forced onscreen, frames wider than the monitor's workarea are converted | 457 | When forced onscreen, frames wider than the monitor's workarea are converted |
| 452 | to fullwidth, and frames taller than the workarea are converted to fullheight. | 458 | to fullwidth, and frames taller than the workarea are converted to fullheight. |
| 453 | NOTE: This only works for non-iconified frames. Internal use only." | 459 | NOTE: This only works for non-iconified frames." |
| 454 | (pcase-let* ((`(,left ,top ,width ,height) (cl-cdadr (frame-monitor-attributes frame))) | 460 | (pcase-let* ((`(,left ,top ,width ,height) (cl-cdadr (frame-monitor-attributes frame))) |
| 455 | (right (+ left width -1)) | 461 | (right (+ left width -1)) |
| 456 | (bottom (+ top height -1)) | 462 | (bottom (+ top height -1)) |
| @@ -642,7 +648,7 @@ Internal use only." | |||
| 642 | ;; FIXME: iconified frames should be checked too, | 648 | ;; FIXME: iconified frames should be checked too, |
| 643 | ;; but it is impossible without deiconifying them. | 649 | ;; but it is impossible without deiconifying them. |
| 644 | (not (eq (frame-parameter frame 'visibility) 'icon))) | 650 | (not (eq (frame-parameter frame 'visibility) 'icon))) |
| 645 | (frameset--move-onscreen frame force-onscreen)) | 651 | (frameset-move-onscreen frame force-onscreen)) |
| 646 | 652 | ||
| 647 | ;; Let's give the finishing touches (visibility, tool-bar, maximization). | 653 | ;; Let's give the finishing touches (visibility, tool-bar, maximization). |
| 648 | (when lines (push lines alt-cfg)) | 654 | (when lines (push lines alt-cfg)) |
| @@ -652,7 +658,7 @@ Internal use only." | |||
| 652 | frame)) | 658 | frame)) |
| 653 | 659 | ||
| 654 | (defun frameset--minibufferless-last-p (state1 state2) | 660 | (defun frameset--minibufferless-last-p (state1 state2) |
| 655 | "Predicate to sort frame states in a suitable order to be created. | 661 | "Predicate to sort frame states in an order suitable for creating frames. |
| 656 | It sorts minibuffer-owning frames before minibufferless ones." | 662 | It sorts minibuffer-owning frames before minibufferless ones." |
| 657 | (pcase-let ((`(,hasmini1 ,id-def1) (assq 'frameset--mini (car state1))) | 663 | (pcase-let ((`(,hasmini1 ,id-def1) (assq 'frameset--mini (car state1))) |
| 658 | (`(,hasmini2 ,id-def2) (assq 'frameset--mini (car state2)))) | 664 | (`(,hasmini2 ,id-def2) (assq 'frameset--mini (car state2)))) |
| @@ -665,7 +671,7 @@ It sorts minibuffer-owning frames before minibufferless ones." | |||
| 665 | (defun frameset-keep-original-display-p (force-display) | 671 | (defun frameset-keep-original-display-p (force-display) |
| 666 | "True if saved frames' displays should be honored." | 672 | "True if saved frames' displays should be honored." |
| 667 | (cond ((daemonp) t) | 673 | (cond ((daemonp) t) |
| 668 | ((eq system-type 'windows-nt) nil) | 674 | ((eq system-type 'windows-nt) nil) ;; Does ns support more than one display? |
| 669 | (t (not force-display)))) | 675 | (t (not force-display)))) |
| 670 | 676 | ||
| 671 | (defun frameset-minibufferless-first-p (frame1 _frame2) | 677 | (defun frameset-minibufferless-first-p (frame1 _frame2) |