aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgcv <gepardcv@gmail.com>2022-04-11 22:47:56 -0700
committergcv <gepardcv@gmail.com>2022-04-11 22:47:56 -0700
commit9f898cadc43c2c2e947d72636af30f028e2b925f (patch)
treefbcbbc86dd62789fcbb5ac6746c2780c603c430d
parent663497f8585df892cf1a505d19d7b28b503b6531 (diff)
Move code around to make the byte-compiler happy.
-rw-r--r--perspective.el48
1 files changed, 24 insertions, 24 deletions
diff --git a/perspective.el b/perspective.el
index ff340f9..ee6e8d4 100644
--- a/perspective.el
+++ b/perspective.el
@@ -172,6 +172,28 @@ After BODY is evaluated, frame parameters are reset to their original values."
(window-configuration (current-window-configuration))
(point-marker (point-marker)))
+(defmacro with-current-perspective (&rest body)
+ "Operate on BODY when we are in a perspective."
+ (declare (indent 0))
+ `(when (persp-curr)
+ ,@body))
+
+(defmacro with-perspective (name &rest body)
+ "Switch to the perspective given by NAME while evaluating BODY."
+ (declare (indent 1))
+ (let ((old (cl-gensym)))
+ `(progn
+ (let ((,old (with-current-perspective (persp-current-name)))
+ (last-persp-cache (persp-last))
+ (result))
+ (unwind-protect
+ (progn
+ (persp-switch ,name 'norecord)
+ (setq result (progn ,@body)))
+ (when ,old (persp-switch ,old 'norecord)))
+ (set-frame-parameter nil 'persp--last last-persp-cache)
+ result))))
+
(defun persp--make-ignore-buffer-rx ()
(defvar ido-ignore-buffers)
(if ido-ignore-buffers
@@ -212,12 +234,12 @@ INCLUDE-GLOBAL."
collect (buffer-name buf))))
(defun persp-is-current-buffer (buf &optional include-global)
- "Return T if BUF is in the current perspective. When INCLUDE-GLOBAL also
+ "Return T if BUF is in the current perspective. When INCLUDE-GLOBAL, also
return T if BUF is in the frame global perspective."
(memq buf (persp-current-buffers* include-global)))
(defun persp-buffer-filter (buf &optional include-global)
- "Return F if BUF is in the current perspective. when INCLUDE-GLOBAL also
+ "Return F if BUF is in the current perspective. When INCLUDE-GLOBAL, also
return F if BUF is in the frame global perspective. Used for filtering in buffer
display modes like ibuffer."
(not (persp-is-current-buffer buf include-global)))
@@ -234,12 +256,6 @@ EXCLUDE-GLOBAL include buffers that are members of the frame global perspective.
(and (not (null name))
(not (string= "" name))))
-(defmacro with-current-perspective (&rest body)
- "Operate on BODY when we are in a perspective."
- (declare (indent 0))
- `(when (persp-curr)
- ,@body))
-
(defun persp-current-name ()
"Get the name of the current perspective."
(persp-name (persp-curr)))
@@ -574,22 +590,6 @@ REQUIRE-MATCH can take the same values as in `completing-read'."
(persp-names)
nil require-match nil nil default))
-(defmacro with-perspective (name &rest body)
- "Switch to the perspective given by NAME while evaluating BODY."
- (declare (indent 1))
- (let ((old (cl-gensym)))
- `(progn
- (let ((,old (with-current-perspective (persp-current-name)))
- (last-persp-cache (persp-last))
- (result))
- (unwind-protect
- (progn
- (persp-switch ,name 'norecord)
- (setq result (progn ,@body)))
- (when ,old (persp-switch ,old 'norecord)))
- (set-frame-parameter nil 'persp--last last-persp-cache)
- result))))
-
(defun persp-reset-windows ()
"Remove all windows, ensure the remaining one has no window parameters.
This prevents the propagation of reserved window parameters like