Re: [tip for EXWM users] An alternative method for isolate trees
Hi Kyle, You are right. When running emacs without my personal config things work as described in the manual. I should have verified that first. My best, Julian Kyle Meyer writes: > Julian M. Burgos writes: > >> I have not noticed that org-tree-to-indirect-buffer >> reuses the indirect buffer when you call it for a second time. >> According to the manual, "with a C-u prefix, do not remove the >> previously used indirect buffer", but that does not seem to work. >> When you do Cu-Cc-Cx-b from a buffer that already has an indirect >> buffer you get a "cannot modify an area being edited in a dedicated >> buffer". If you try it from a different buffer, the prefix is ignored >> and the indirect buffer is assigned to the tree from the last buffer. > > Hmm, could you provide a reproducer for the problem? Here's what I > tried with the current master (afd75d05a), Emacs 27.1, and no custom > configuration. > > --8<---cut here---start->8--- > * a > a content > * b > b content > --8<---cut here---end--->8--- > > - on "a", C-c C-x b ;; org-tree-to-indirect-buffer >Displays -a-1 buffer. > > - move to "b", C-u C-c C-x b >Displays -b-1 buffer, a-1 buffer still exists. -- Julian Mariano Burgos, PhD Hafrannsóknastofnun, rannsókna- og ráðgjafarstofnun hafs og vatna/ Marine and Freshwater Research Institute Botnsjávarsviðs / Demersal Division Fornubúðir 5, IS-220 Hafnarfjörður, Iceland www.hafogvatn.is Sími/Telephone : +354-5752037 Netfang/Email: julian.bur...@hafogvatn.is
Re: [tip for EXWM users] An alternative method for isolate trees
Julian M. Burgos writes: > I have not noticed that org-tree-to-indirect-buffer > reuses the indirect buffer when you call it for a second time. > According to the manual, "with a C-u prefix, do not remove the > previously used indirect buffer", but that does not seem to work. > When you do Cu-Cc-Cx-b from a buffer that already has an indirect > buffer you get a "cannot modify an area being edited in a dedicated > buffer". If you try it from a different buffer, the prefix is ignored > and the indirect buffer is assigned to the tree from the last buffer. Hmm, could you provide a reproducer for the problem? Here's what I tried with the current master (afd75d05a), Emacs 27.1, and no custom configuration. --8<---cut here---start->8--- * a a content * b b content --8<---cut here---end--->8--- - on "a", C-c C-x b ;; org-tree-to-indirect-buffer Displays -a-1 buffer. - move to "b", C-u C-c C-x b Displays -b-1 buffer, a-1 buffer still exists.
Re: [tip for EXWM users] An alternative method for isolate trees
Hi Julian, "Julian M. Burgos" writes: > This does not seem to be a limitation from emacs, as it is possible to > open multiple indirect buffers from a base buffer, using for example > clone-indirect-buffer. So it should be possible to make a function > combining "clone-indirect-buffer" and "org-narrow-to-subtree" perhaps? > I am thinking so this option is available not only to EXWM users. I think that combining clone-indirect-buffer and org-narrow-to-subtree would work well. Another way to isolate several trees at once is by using the excellent package org-sidebar (https://github.com/alphapapa/org-sidebar). In fact, I borrowed from this package the idea of renaming the new buffers with the string :: (if I open helm and start typing ::, it shows me the list of isolated trees, so it's very useful to have a dedicated string). Although my method for isolating each tree is more pedestrian :-). And it only makes sense in EXWM... Best regards, Juan Manuel
Re: [tip for EXWM users] An alternative method for isolate trees
Hi Juan, You are right. :) I have not noticed that org-tree-to-indirect-buffer reuses the indirect buffer when you call it for a second time. According to the manual, "with a C-u prefix, do not remove the previously used indirect buffer", but that does not seem to work. When you do Cu-Cc-Cx-b from a buffer that already has an indirect buffer you get a "cannot modify an area being edited in a dedicated buffer". If you try it from a different buffer, the prefix is ignored and the indirect buffer is assigned to the tree from the last buffer. This does not seem to be a limitation from emacs, as it is possible to open multiple indirect buffers from a base buffer, using for example clone-indirect-buffer. So it should be possible to make a function combining "clone-indirect-buffer" and "org-narrow-to-subtree" perhaps? I am thinking so this option is available not only to EXWM users. Ideally, there should be an option to allow org-tree-to-indirect-buffer to create more than one indirect buffer if desired. My best, Julian Juan Manuel Macías writes: > Hi Julian, thanks for your comment. > > "Julian M. Burgos" writes: > >> Thank you, although I tested your functions and compared with the >> original org-tree-to-indirect-buffer, the only difference I see is >> that your function creates a new exwm workspace. The original function >> already creates indirect buffers with their own names (using a slash >> instead of the double colons). Or I am missing something? > > org-tree-to-indirect-buffer creates a new buffer, but (as far as I know) > does not allow accumulating buffers. In other words, you cannot have > several isolated trees at the time. In this method it just occurred to > me to configure org-indirect-buffer-display as new-frame and take > advantage of EXWM frame management. > > Best regards, > > Juan Manuel -- Julian Mariano Burgos, PhD Hafrannsóknastofnun, rannsókna- og ráðgjafarstofnun hafs og vatna/ Marine and Freshwater Research Institute Botnsjávarsviðs / Demersal Division Fornubúðir 5, IS-220 Hafnarfjörður, Iceland www.hafogvatn.is Sími/Telephone : +354-5752037 Netfang/Email: julian.bur...@hafogvatn.is
Re: [tip for EXWM users] An alternative method for isolate trees
Hi Julian, thanks for your comment. "Julian M. Burgos" writes: > Thank you, although I tested your functions and compared with the > original org-tree-to-indirect-buffer, the only difference I see is > that your function creates a new exwm workspace. The original function > already creates indirect buffers with their own names (using a slash > instead of the double colons). Or I am missing something? org-tree-to-indirect-buffer creates a new buffer, but (as far as I know) does not allow accumulating buffers. In other words, you cannot have several isolated trees at the time. In this method it just occurred to me to configure org-indirect-buffer-display as new-frame and take advantage of EXWM frame management. Best regards, Juan Manuel
Re: [tip for EXWM users] An alternative method for isolate trees
Hi Juan Manuel, Thank you, although I tested your functions and compared with the original org-tree-to-indirect-buffer, the only difference I see is that your function creates a new exwm workspace. The original function already creates indirect buffers with their own names (using a slash instead of the double colons). Or I am missing something? My best, Julian Juan Manuel Macías writes: > Hi, > > Since EXWM uses Emacs frames as virtual desktops, I have written this > alternative method of `org-tree-to-indirect-buffer', which I share here. > With this method I can have several isolated trees, with their own name, > and access them quickly (with helm-buffer-list, for example): > > #+begin_src emacs-lisp > (defun my-goto-buffer-regexp (regexp) > (dolist (buffer (buffer-list)) > (let ((name (buffer-name buffer))) > (when (and name (not (string-equal name "")) > (string-match regexp name)) > (switch-to-buffer buffer) > > (defun my-org-tree-to-indirect-buffer () > (interactive) > (let ((buf (buffer-name)) > (ind-buf (replace-regexp-in-string "\\[.+\\]" "" (nth 4 > (org-heading-components > (org-indirect-buffer-display 'new-frame)) > (org-tree-to-indirect-buffer) > (my-goto-buffer-regexp ind-buf) > (rename-buffer (concat buf "::" ind-buf > #+end_src > > Best regards, > > Juan Manuel -- Julian Mariano Burgos, PhD Hafrannsóknastofnun, rannsókna- og ráðgjafarstofnun hafs og vatna/ Marine and Freshwater Research Institute Botnsjávarsviðs / Demersal Division Fornubúðir 5, IS-220 Hafnarfjörður, Iceland www.hafogvatn.is Sími/Telephone : +354-5752037 Netfang/Email: julian.bur...@hafogvatn.is
[tip for EXWM users] An alternative method for isolate trees
Hi, Since EXWM uses Emacs frames as virtual desktops, I have written this alternative method of `org-tree-to-indirect-buffer', which I share here. With this method I can have several isolated trees, with their own name, and access them quickly (with helm-buffer-list, for example): #+begin_src emacs-lisp (defun my-goto-buffer-regexp (regexp) (dolist (buffer (buffer-list)) (let ((name (buffer-name buffer))) (when (and name (not (string-equal name "")) (string-match regexp name)) (switch-to-buffer buffer) (defun my-org-tree-to-indirect-buffer () (interactive) (let ((buf (buffer-name)) (ind-buf (replace-regexp-in-string "\\[.+\\]" "" (nth 4 (org-heading-components (org-indirect-buffer-display 'new-frame)) (org-tree-to-indirect-buffer) (my-goto-buffer-regexp ind-buf) (rename-buffer (concat buf "::" ind-buf #+end_src Best regards, Juan Manuel