0

I like being able to filter by tag and I like to use helm-org-in-buffer-heading helm/ worf-goto worf.

Is it possible to combine them?

I.e, with Worf-goto I can search headings and their tags, but it doesn't list headings that should inherit the tag. e.g

* Emacs tasks :emacs:
** Figure out ultimate macro that will do my work for me
** Make emacs make my coffee in the morning

If I search for ':emacs ultimate', ideally it should match the 1st sub-item, but worf-goto/helm-heading search doesn't. It can either find the line with :emacs: or the line with 'ultimate', it can't match them both.

The agenda view C-c s kinda works. I can first do a search and then narrow down via tags. But this is a 2 step process and it only works on agenda files. I have a lot of non-agenda org files that I'd like to parse with heading/tag combo.

Thoughts?

[EDIT]
At the moment I'm tagging every headings with all the tags (e.g below) and I'm looking forward to the day where I can make use of the inheritance instead.

* Emacs tasks :emacs:
** Figure out ultimate macro that will do my work for me  :emacs:
** Make emacs make my coffee in the morning  :emacs:

2 Answers 2

0

I figured it out after a while.

C-c a  (agenda)
m   (match tags)
(helm-swoop) 

With this combo I first search headlines by tag, and then I can narrow things down further with helm.

The only thing is that I need to have all the files I want to search as Agenda files.

0

Here's a very rough sketch. The idea is to collect all tags with org-get-tags, which also collects inherited tags, and add them to candidate in place of the old tags.

(cl-defmethod helm-setup-user-source ((source helm-org-headings-class))
  (setf (slot-value source 'candidate-transformer)
        '((lambda (candidates)
            (helm-org-get-candidates candidates))
          (lambda (candidates)
            (cl-loop
             for i in candidates
             for len = (string-width (car i))
             for hl = (when (string-match
                             "^\\(\\**\\)\\(\\* \\)\\(.[^:\n\]*\\)\\(:.+:\\)?" (car i))
                        (replace-match "\\1\\2\\3" t nil (car i)))
             for col = (if (> org-tags-column 0)
                       org-tags-column (- org-tags-column))
             for trunc = (if (> len col)
                             (helm-substring hl col)
                           hl)
             for sep = (make-string (- col (length trunc))
                                    ?\s)
             for tags = (with-helm-current-buffer
                          (let ((tag (org-get-tags (goto-char (cdr i)))))
                            (if tag (concat ":" (mapconcat #'identity tag ":") ":")
                  "")))
             collect (cons (concat trunc sep tags)
                           (cdr i))))))
  (setf (slot-value source 'filtered-candidate-transformer)
    '(helm-fuzzy-highlight-matches)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.