org-ql icon indicating copy to clipboard operation
org-ql copied to clipboard

let org-ql-view-refresh respect custom buffer name

Open whudwl opened this issue 9 months ago • 2 comments

OS/platform

any

Emacs version and provenance

not relevant

Org version and provenance

not relevant

org-ql package version and provenance

any

Description

Say I have done a search with the code below, notice that I've named the buffer habit

(org-ql-search '("~/org/habit.org") '(property "STYLE" "habit") :buffer "habit")

Now if I press r in the habit buffer, the buffer gets named to *Org QL View: (property STYLE habit)*.
If I rerun the code above, and press r again, the buffer gets named to *Org QL View: (property STYLE habit)*<1>.

I think it's preferable to let org-ql-view-refresh use the buffer name I've chosen.

Etc.

No response

whudwl avatar May 03 '24 07:05 whudwl

BTW, note that there's already a habit predicate, so you needn't use the property predicate to find them.

Anyway, how would you suggest that we know whether the user wants to keep a buffer's name or change it to match the new search?

I'd generally suggest that you assign the search a title and access it with, e.g. saved views, bookmarks, or links, rather than manually evaluating that expression.

alphapapa avatar May 03 '24 11:05 alphapapa

That makes a lot of sense, I'll use or-ql-view instead for my pre-defined searches.

Out of curiosity, in which case is the following part in org-ql-view-refresh useful? It seems I can just remove it without causing any issues.

(rename-buffer (format "%s %s*"
                           org-ql-view-buffer-name-prefix
                           (or org-ql-view-title org-ql-view-query))
                   ;; Avoid any errors in case a buffer by this name already exists.
                   'unique)

whudwl avatar May 06 '24 02:05 whudwl