emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [FR] org-colview.el, add annotation for functions summary-types


From: Sławomir Grochowski
Subject: Re: [FR] org-colview.el, add annotation for functions summary-types
Date: Fri, 16 Aug 2024 13:13:37 +0200

Ihor Radchenko <yantar92@posteo.net> writes:

> Ok. But please double-check that it is really the case.

Checked.

So I have those 3 code snipets: 

(defun org-columns--summary-types-completion-function (string)
  (docstring-first-line
   (cdr (assoc string (append
                       org-columns-summary-types
                       org-columns-summary-types-default)))))

(completing-read
 "Summary: "
 (lambda (string pred flag)
   (pcase flag
     ('t (all-completions string
                          (delete-dups
                           (cons '("")  ;Allow empty operator.
                                 (mapcar #'car (append
                                                org-columns-summary-types
                                                
org-columns-summary-types-default))))
                          pred))
     ('metadata (list 'metadata
                      (cons 'annotation-function
                            
'org-columns--summary-types-completion-function))))))


(defun docstring-first-line (fun)
  (let* ((doc (condition-case nil (documentation fun) (error nil)))
         (doc (and doc (substring doc 0 (string-search "\n" doc)))))
    (if doc
        (format " -- %s" doc)
      "")))

But I have no idea where to put this piece:

 (if doc
        (format " -- %s" doc)
      "")

It should not be in docstring-first-line. 
What do you think? 

-- 
Slawomir Grochowski



reply via email to

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