emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: [emacs-humanities] Paper Zettelkasten safety [was: Why Emacs-humanities?]
       [not found]                 ` <878s237k1u.fsf@localhost>
@ 2021-07-19  5:00                   ` Jean Louis
  0 siblings, 0 replies; only message in thread
From: Jean Louis @ 2021-07-19  5:00 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Göktuğ Kayaalp, Org Mode

* 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/


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-19  5:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87h7ocxamv.fsf@gkayaalp.com>
     [not found] ` <87lfdnzq6x.fsf@localhost>
     [not found]   ` <YLvsb0Q/pagS57yL@protected.localdomain>
     [not found]     ` <87wnq63007.fsf@localhost>
     [not found]       ` <YOGbQp9SkTdvIogc@protected.localdomain>
     [not found]         ` <87r1g5un3s.fsf@localhost>
     [not found]           ` <YOrxgX2VrJYagNSJ@protected.localdomain>
     [not found]             ` <87eebx6mwj.fsf@localhost>
     [not found]               ` <YPL49TxUZCE7F7Oy@protected.localdomain>
     [not found]                 ` <878s237k1u.fsf@localhost>
2021-07-19  5:00                   ` [emacs-humanities] Paper Zettelkasten safety [was: Why Emacs-humanities?] Jean Louis

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).