From bd97ef47ef8eb294c728ceb91ece2d34e90cf2d5 Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Tue, 20 Aug 2019 00:54:41 -0400 Subject: [PATCH] Move doc for layout restriction and SPC TAB to DOCUMENTATION.org --- doc/DOCUMENTATION.org | 47 +++++++++++++++++ .../+spacemacs/spacemacs-layouts/README.org | 52 ------------------- 2 files changed, 47 insertions(+), 52 deletions(-) diff --git a/doc/DOCUMENTATION.org b/doc/DOCUMENTATION.org index 4c1132108..9955ce7b4 100644 --- a/doc/DOCUMENTATION.org +++ b/doc/DOCUMENTATION.org @@ -98,6 +98,8 @@ - [[#custom-layouts][Custom Layouts]] - [[#saveload-layouts-into-a-file][Save/Load layouts into a file]] - [[#layout-key-bindings][Layout key bindings]] + - [[#behavior-of-spc-tab-with-layouts][Behavior of SPC TAB with layouts]] + - [[#restrict-a-given-function-to-the-current-layout][Restrict a given function to the current layout]] - [[#workspaces][Workspaces]] - [[#workspace-key-bindings][Workspace key bindings]] - [[#commands][Commands]] @@ -1749,6 +1751,51 @@ Press ~?~ to toggle the full help. | ~x~ | kill current layout with its buffers | | ~X~ | kill other layouts with their buffers | +*** Behavior of SPC TAB with layouts +By default ~SPC TAB~ which switches to last opened buffer is restricted to the +current layout. If there is only one opened buffer for a given layout then +~SPC TAB~ won't do anything and the following message is displayed in the +minibuffer: + +#+begin_quote +Last buffer not found. +#+end_quote + +To allow ~SPC TAB~ to switch to the last opened buffer from another layout set +this variable =spacemacs-layouts-restrict-spc-tab= to =nil=. For instance in +your used layer list with layer variables: + +#+begin_example emacs-lisp + (spacemacs-layouts :variables spacemacs-layouts-restrict-spc-tab t) +#+end_example + +*** Restrict a given function to the current layout +You can make any function "layout aware" by adding it to the list +=spacemacs-layouts-restricted-functions=. It is not possible to change this +variable when Emacs is running. You have to define it using layer variables. +If you change this variable then Emacs must be restarted for the change to +take effect. + +Default value for this variable is: + +#+begin_example emacs-lisp + '(spacemacs/window-split-double-columns + spacemacs/window-split-triple-columns + spacemacs/window-split-grid) +#+end_example + +If you want to add the function =my-func= to this list you need to redefine +the complete list using layer variables: + +#+BEGIN_EXAMPLE + (spacemacs-layouts :variables + spacemacs-layouts-restricted-functions + '(spacemacs/window-split-double-columns + spacemacs/window-split-triple-columns + spacemacs/window-split-grid + my-func)) +#+END_EXAMPLE + ** Workspaces Workspaces are sub-layouts, they allow to define multiple layouts into a given layout, those layouts share the same buffer as the parent layout. diff --git a/layers/+spacemacs/spacemacs-layouts/README.org b/layers/+spacemacs/spacemacs-layouts/README.org index 0b7e1ef7c..90cfc72ff 100644 --- a/layers/+spacemacs/spacemacs-layouts/README.org +++ b/layers/+spacemacs/spacemacs-layouts/README.org @@ -5,8 +5,6 @@ * Table of Contents :TOC_5_gh:noexport: - [[#description][Description]] - [[#features][Features:]] -- [[#restrict-functions-to-the-current-layouts-buffers][Restrict functions to the current layout's buffers]] -- [[#restrict-spc-tab-to-the-current-layouts-buffers][Restrict SPC-TAB to the current layout's buffers]] * Description This layer adds support for distinct layouts/workspaces to Spacemacs. @@ -14,53 +12,3 @@ This layer adds support for distinct layouts/workspaces to Spacemacs. ** Features: - Support for distinct layouts via =eyebrowse= - Integration with =helm= and =ivy= to search for buffers within layouts - -* Restrict functions to the current layout's buffers -Besides =helm-mini= and =ivy-switch-buffer= that are aware of a layout's -buffers. This layer also provides a ~spacemacs-layouts-restricted-functions~ -variable that holds a list of functions that will be restricted to the current -layout's buffers. - -Default value of ~spacemacs-layouts-restricted-functions~ is: - -#+BEGIN_EXAMPLE - '(spacemacs/window-split-double-columns - spacemacs/window-split-triple-columns - spacemacs/window-split-grid) -#+END_EXAMPLE - -The list can be edited in the ~dotspacemacs-configuration-layers~ variable near -the top of ~.spacemacs~ like this: - -#+BEGIN_EXAMPLE - (spacemacs-layouts :variables - spacemacs-layouts-restricted-functions - '(spacemacs/window-split-double-columns - spacemacs/window-split-triple-columns - spacemacs/window-split-grid)) -#+END_EXAMPLE - -Note that ~spacemacs-layouts-restricted-functions~ can only be changed in the -~dotspacemacs-configuration-layers~ variable. They can't be edited during the -current Emacs session. A restart is required. - -* Restrict SPC-TAB to the current layout's buffers -When the ~spacemacs-layouts-restrict-spc-tab~ variable is set to ~t~, then -~SPC-TAB~ (~spacemacs/alternate-buffer~) will be restricted to only switch -between the current layout's buffers. - -Default value of ~spacemacs-layouts-restrict-spc-tab~ is ~nil~. - -It can be enabled in the ~dotspacemacs-configuration-layers~ variable near the -top of ~.spacemacs~ like this: - -#+BEGIN_EXAMPLE - (spacemacs-layouts :variables spacemacs-layouts-restrict-spc-tab t) -#+END_EXAMPLE - -Note that ~spacemacs-layouts-restrict-spc-tab~ also can be toggle on the fly by -evaluating it like this: - -#+BEGIN_EXAMPLE - (setq spacemacs-layouts-restrict-spc-tab t) -#+END_EXAMPLE