emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Completion of links to man pages
@ 2023-10-04 11:40 Max Nikulin
  2023-10-05 11:40 ` Ihor Radchenko
  2023-12-09 11:32 ` Ihor Radchenko
  0 siblings, 2 replies; 23+ messages in thread
From: Max Nikulin @ 2023-10-04 11:40 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I am unsure if the code below is appropriate for :complete property of 
"man" link. It does not rely on any double-dash functions or variables, 
but it still uses some implementation details since there is no suitable 
high level functions in man.el and woman.el from Emacs.

(defun org-man-complete (&optional _arg)
   "Helper for completion of links to man pages."
   (concat
    "man:"
    (let ((completion-ignore-case t)) ; See `man' comments.
      (funcall
       (if (eq org-man-command 'woman)
           #'org-man--complete-woman
         #'org-man--complete-man)
       "Manual entry: "))))

(defun org-man--complete-man (prompt)
   (require 'man)
   (let (Man-completion-cache)
     (completing-read
      prompt
      'Man-completion-table)))

(defun org-man--init-woman-cache (&optional re-cache)
   (unless (and (not re-cache)
                (or
                 (and woman-expanded-directory-path
                      woman-topic-all-completions)
                 (woman-read-directory-cache)))
     (setq woman-expanded-directory-path
           (woman-expand-directory-path woman-manpath woman-path))
     (setq woman-totic-all-completions
           (woman-topic-all-completions woman-expand-directory-path))
     (woman-write-directory-cache)))

(defun org-man--complete-woman (prompt)
   (require 'woman)
   (org-man--init-woman-cache)
   (completing-read prompt woman-topic-all-completions))



^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2023-12-14 15:07 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-04 11:40 Completion of links to man pages Max Nikulin
2023-10-05 11:40 ` Ihor Radchenko
2023-10-05 12:20   ` Max Nikulin
2023-10-05 12:48     ` Ihor Radchenko
2023-10-05 15:59       ` Max Nikulin
2023-10-05 16:15         ` Ihor Radchenko
2023-10-05 16:37           ` Eli Zaretskii
2023-10-05 16:55             ` Ihor Radchenko
2023-10-05 17:13               ` Eli Zaretskii
2023-10-05 17:30                 ` Ihor Radchenko
     [not found]                 ` <ufnvit$12ho$1@ciao.gmane.io>
2023-10-06 21:37                   ` Richard Stallman
2023-10-07 11:14                 ` Michael Albinus
2023-10-06  3:58           ` Max Nikulin
2023-10-05 15:52   ` Eli Zaretskii
2023-10-05 16:05     ` Ihor Radchenko
2023-10-05 16:33       ` Eli Zaretskii
2023-10-05 16:53         ` Ihor Radchenko
2023-10-05 17:11           ` Eli Zaretskii
2023-10-05 17:36             ` Ihor Radchenko
2023-10-06  3:16             ` Max Nikulin
2023-12-09 11:32 ` Ihor Radchenko
2023-12-13 15:20   ` [PATCH] ol-man.el: Enable completion Max Nikulin
2023-12-14 15:09     ` Ihor Radchenko

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).