legalnonsense/elgantt

Gantt View Limited to a Certain Heading Level (e.g., up to *** headings)

Opened this issue · 1 comments

I can use column to see headings levels 1 through 2 by going into column view C-c C-x C-c and typing C-u 2 S-TAB. Using a modified version of your test.org file, I can jump between columnview of all headings and column view up to level 2.

Screen Shot 2021-08-15 at 8 36 52 AM

I can then type C-u 2 S-TAB to get

Screen Shot 2021-08-15 at 8 37 51 AM

I know it should be possible because you simply use org-ql, but I am not quite sure where in you code I could make this change. Is there a way to tell El Gantt to limit itself to headings of a certain level?

Okay, I figured it out. Your packaged is well written. If you legal work is like your code, your clients are doing well.

Below, I show how to restrict to level 1 and 2 headings. It would be quite simple to modify the code to do what I want.

(defun elgantt--iterate ()
  "Iterate over all entries in `elgantt-agenda-files'."
  (if elgantt-insert-header-even-if-no-timestamp
      ;; Seems wasteful to write two separate queries, but
      ;; I do not know how to format a single org-ql query
      ;; to include or exclude timestamps depending on the value of 
      ;; the horribly named `elgantt-insert-header-even-if-no-timestamp'
      (mapc #'elgantt--insert-entry
	    (-non-nil
	     (org-ql-select elgantt-agenda-files
	       `(not (tags ,(when elgantt-skip-archives
			      org-archive-tag)))
	       :action #'elgantt--parser)))
    (mapc #'elgantt--insert-entry
	  (-non-nil
	   (org-ql-select elgantt-agenda-files
	     `(and (ts :from ,elgantt-start-date)
		   (not (tags ,(when elgantt-skip-archives
				 org-archive-tag)))
;;		   (level #'<= 2)    ;; Add this to only show headings up to level 2
		   )
	     :action #'elgantt--parser)))))```