2
votes

I'm having a weird problem with Emacs (doom-emacs) on macOS (brew cask emacs-mac-spacemacs-icon): I sporadically cannot fold a heading. I can unfold it, then its children are shown, however, when I try to fold it I get the message "No matching item found on the current line". Sometimes it works again after changing to another application and tabbing back, the the message line shows "FOLDED" and "CHILDREN" when I press the Tab key.

It also works in some org files, but not in others. I don't know what's differen between them.

I just realized that when I have an inactive timestamp as a heading, pressing tab once shows the children but pressing it again just jumps between the brackets...

Here is my configuration:

;; Doom exposes five (optional) variables for controlling fonts in Doom. Here
;; are the three important ones:
;;
;; + `doom-font'
;; + `doom-variable-pitch-font'
;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for
;;   presentations or streaming.
;;
;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd
;; font string. You generally only need these two:
(setq doom-font (font-spec :family "Meslo LG M for Powerline"
                           :size 12))

;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
(setq doom-theme 'doom-gruvbox)

;; Enable visual line mode per default for text files
(add-hook! 'text-mode-hook 'turn-on-visual-line-mode)

;; Enable org-autolist
(add-hook 'org-mode-hook (lambda () (org-autolist-mode)))

;; Org mode configuration
(setq org-directory "~/org")
(setq org-default-clock-file (concat org-directory "/clock.org"))
(after! org
  (setq org-agenda-files (list org-directory))
  (setq org-default-notes-file (concat org-directory "/inbox.org"))
  (setq org-task-file (concat org-directory "/tasks.org"))
  (setq org-log-into-drawer t)
  (setq org-log-done nil)
  (setq org-image-actual-width (/ (display-pixel-width) 3))

  (setq org-todo-keywords
        '((sequence "TODO(t)" "IN-PROGRESS(i!)" "WAITING(@w)" "|"
                    "DONE(d!)" "CANCELED(@c)")))
  (setq org-todo-keyword-faces
        '(
          ("TODO" . (:foreground "#fb4933" :weight bold))
          ("IN-PROGRESS" . (:foreground "#fabd2f" :weight bold))
          ("WAITING" . (:foreground "#fe8019" :weight bold))
          ("DONE" . (:foreground "#8ec07c" :weight bold))
          ("CANCELED" . (:foreground "#83a598" :weight bold))
          )
        )

  (setq org-capture-templates
        `(("r" "Weekly report" entry (file+headline org-default-clock-file "Clock")
           ,(concat "** Woche %<%V>\n"
                   "*** Gesamt\n"
                   "#+BEGIN: clocktable :scope agenda :maxlevel 20 :block 2020-W%<%V> :step week :stepskip0 t\n"
                   "#+END:\n"
                   "*** Tage\n"
                   "#+BEGIN: clocktable :scope agenda :maxlevel 20 :block 2020-W%<%V> :step day :stepskip0 t\n"
                   "#+END:"
                   )
           )))

  (setq org-startup-indented t)
  (setq org-clock-persist 'history)
  (org-clock-persistence-insinuate)
  (setq org-duration-format (quote h:mm))
  (setq org-refile-targets '((org-agenda-files :maxlevel . 10)))
  (setq org-goto-interface 'outline-path-completion)

  (defvar org-created-property-name "CREATED"
    "The name of the org-mode property that stores the creation date of the entry")

  (defun org-set-created-property (&optional active NAME)
    "Set a property on the entry giving the creation time.
           By default the property is called CREATED. If given the `NAME'
           argument will be used instead. If the property already exists, it
          will not be modified."
    (interactive)
    (let* ((created (or NAME org-created-property-name))
           (fmt (if active "<%s>" "[%s]"))
           (now  (format fmt (format-time-string "%Y-%m-%d %a %H:%M"))))
      (unless (org-entry-get (point) created nil)
        (org-set-property created now))))

  ;; Key mappings
  (map! :leader
        (:prefix ("o" . "org")
        :desc "Goto"                      "g" 'org-goto
        :desc "Insert inactive timestamp" "!" 'org-time-stamp-inactive
        :desc "Update dynamic block"      "u" 'org-dblock-update
        :desc "Todo list"                 "t" 'org-todo-list
        :desc "Agenda"                    "a" 'org-agenda
        :desc "Tag search"                "m" 'org-tags-view
        :desc "Search org headlines"      "h" #'+default/org-notes-headlines
        :desc "Search org files"          "s" #'+default/org-notes-search
        :desc "Refile"                    "r" 'org-refile
        :desc "Browse notes"              "f" #'+default/browse-notes
        :desc "Search notes for symbol"   "." #'+default/search-notes-for-symbol-at-point
        :desc "Org capture"               "n" #'org-capture
        (:prefix ("c" . "clock")
          :desc "Clock in" "i" 'org-clock-in
          :desc "Clock out" "o" 'org-clock-out
          :desc "Jump to last clock" "l" (lambda () (interactive) (setq current-prefix-arg '(4)) (org-clock-goto))
          :desc "Jump to active clock" "j" 'org-clock-goto)
        (:prefix ("p" . "properties")
          :desc "Set CREATED property"      "c" 'org-set-created-property)
        ))
  )

;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type t)

;; Key unmappings
(map! :leader "n" nil)
(map! :leader "o" nil)
1
I'm having the same issue also using doom. It seems to work sporadically. Interestingly, org-shifttab works as expected. Yet most of the time, I cannot fold/unfold my todo hierarchies with org-cycle. It's an annoying problem I can't seem to fix.sunflower_fields_forever

1 Answers

0
votes

i had this problem with doom, due to a keybinding conflict with evil-jump-item. I fixed it by rebinding tab:

(map! :after evil-org
  :map org-mode-map
  :desc "org-cycle" :n [tab] #'org-cycle)