Giter Club home page Giter Club logo

Comments (4)

akirak avatar akirak commented on July 28, 2024 1

You are probably right. If I need a narrowed view but still need to browse all headings with rifle, I'll create an indirect buffer. Thanks.

from org-rifle.

alphapapa avatar alphapapa commented on July 28, 2024 1

@chasecaleb FYI, I'm not likely to notice comments posted on closed issues. If you think something needs to be changed in this package, please open a new issue and we can talk about it.

from org-rifle.

alphapapa avatar alphapapa commented on July 28, 2024

Hmm, I'm not sure about this. I think it's generally best to obey narrowing unless there's a good reason to override it. I've never needed it to work by widening, and I haven't had anyone mention it until now. I can think of situations in which I would not want the buffer widened, e.g. I have a large file with subtrees, and I have the buffer narrowed to a project's subtree (probably in an indirect buffer), and then I want to use rifle to search in the subtree. If it widened by default, I would get results for the whole buffer. If I wanted to get results for the whole buffer, I would run the rifle command in the unnarrowed, direct buffer, or use a rifle command that searched all buffers.

What do you think?

from org-rifle.

chasecaleb avatar chasecaleb commented on July 28, 2024

or use a rifle command that searched all buffers.

@alphapapa can you elaborate on this? I'm not sure what you mean by "all buffers", because for instance helm-org-rifle-agenda-files searches all agenda file buffers but it is still affected by narrowing. I use (setq helm-org-rifle-close-unopened-file-buffers nil), in case that's relevant.

Here's my attempt at solving this... it fixes the search results, but I haven't figured out how to tell if I need to permanently widen the buffer when navigating to a result. If you have any pointers in the right direction that would be appreciated!

(defun cc/org-with-wide-buffers-multi--inner (files fn)
  (if (seq-empty-p files)
      (funcall fn)
    (with-current-buffer (or (org-find-base-buffer-visiting (car files))
                             (find-file-noselect (car files)))
      (org-with-wide-buffer
       (cc/org-with-wide-buffers-multi--inner (cdr files) fn)))))

(defmacro cc/org-with-wide-buffers-multi (files &rest body)
  (declare (indent 1) (debug true))
  `(cc/org-with-wide-buffers-multi--inner files (lambda () ,@body)))

(defun cc/helm-org-rifle-agenda-files-widened ()
  (interactive)
  (let ((files (org-agenda-files)))
    (cc/org-with-wide-buffers-multi files
      (helm-org-rifle-files files))))

Context
When I'm working on a task, I frequently narrow the corresponding org buffer to just that task headline. While working on the task I may use org-rifle to go search for something related, but can't find it due to narrowing. It usually goes something like this:

  1. Start working on a task and narrow the corresponding org buffer to its heading
  2. Use helm-org-rifle-agenda-files to search for something, e.g. info in a related task
  3. Scratch my head and check for typos in my search query, since I can't find what I'm looking for
  4. Remember that narrowing is the issue
  5. Do one of the following:
    a. C-g to quit the search, switch to the narrowed buffer, widen it, search again, find what I'm looking for, then re-narrow to the current task again.
    a. More likely: give up and use a different, filesystem-based search method instead (e.g. helm-projectile-ag), since it's easier than doing the previous steps.

I think #32 (perhaps wrapped in an option to enable it?) would be nice, although since I'm only the second one in a couple years to bring this up I'm probably in the minority. Or of course it might be that there aren't many people who use both narrowing and org-rifle that would bother making/commenting on an issue about this.

from org-rifle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.