emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [emacs-humanities] Paper Zettelkasten safety [was: Why Emacs-humanit


From: Jean Louis
Subject: Re: [emacs-humanities] Paper Zettelkasten safety [was: Why Emacs-humanities?]
Date: Mon, 19 Jul 2021 08:00:06 +0300
User-agent: Mutt/2.0.7+183 (3d24855) (2021-05-28)

* Ihor Radchenko <yantar92@gmail.com> [2021-07-18 17:51]:
> Jean Louis <bugs@gnu.support> writes:
> 
> > How do I display the list of tags in Org mode?
> 
> There is nothing like dashboard of tags in Org mode. However, you can
> get a list of all the tags using (org-global-tags-completion-table).

I will move the email to org mode mailing list. Here I am showing
the concept on how to show the tags create buttons. I am using
this in Hyperscope as to list all the tags. But I am not using
Org mode to display it, though that would be better for Org
mode. I did not delete those not necessary variables and
functions below as it is only to show the concept. 

When you run M-x rcd-org-tags you would get a new pop up window
with the list of tags, you can then use Enter or Mouse to invoke
Org agenda on the tag.

Having tags index is useful. Something like this should be in Org mode.

(defun rcd-org-tags (&optional prefix)
  (interactive "p")
  "Report ordered Org tags"
  (let* ((tags (flatten-list (org-global-tags-completion-table)))
         (tags (seq-sort 'string< (seq-uniq tags))))
    (rcd-pop-to-report
     (with-temp-buffer
       (rcd-org-insert-buttons tags)
       (buffer-string))
     nil)))

(defun rcd-org-insert-button (tag)
  (insert-text-button tag
                      'action
                      `(lambda (_) 
                         (org-tags-view nil ,tag)))
                      'follow-link t)

(defun rcd-org-insert-buttons (tags)
  (insert "TAGS:  ")
  (while tags
    (let* ((tag (pop tags)))
      (rcd-org-insert-button tag)
      (insert " ")
        (when (> (current-column) 70) (insert "\n")))))

(defun rcd-pop-to-report (string &optional buffer-name map place refresh 
truncate)
  "Pop the new buffer and inserts STRING.
Quits with `q' if necessary.
BUFFER-NAME is optional.

It will destroy the buffer before display of report."
  (let ((buffer (or buffer-name "*RCD Report*")))
    (when (buffer-live-p (get-buffer buffer))
      (kill-buffer (get-buffer buffer)))
    (save-excursion
      (pop-to-buffer buffer)
      (let ((word-wrap truncate))
        (when word-wrap (toggle-truncate-lines 1))
        (setq rcd-current-table (when (listp place) (cdr (assoc "table" 
place))))
        (setq rcd-current-column (when (listp place) (cdr (assoc "column" 
place))))
        (setq rcd-current-table-id (when (listp place) (cdr (assoc "table-id" 
place))))
        (setq rcd-tabulated-refresh-function refresh)
        (insert string)
        (goto-char 1)
        (if map 
            (use-local-map map)
          (local-set-key (kbd "q") 'delete-window)
          (read-only-mode 1))))))

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]