Commit graph

141 commits

Author SHA1 Message Date
Tim Ruffing
f4e02a2d39 fix(org): don't call org-reveal in dead buffer
This fixes a bug introduced in bb3431a (#7509). This shows up for
example in `org-capture`, which uses multiple org buffers and the
initial one (with name `*Capture*`) will be dead already by the time the
timer runs.

Amend: #7509
2023-11-29 11:30:20 -05:00
Leo Okawa Ericson
31b2ad22fb
fix(org): call org-reveal in correct buffer
Sometimes, `org-reveal` is called in the wrong buffer which throws an
error.  For example, `org-link-open-from-string` creates an temporary
org-mode buffer that gets killed very quickly which means that
`org-reveal` gets called in a different buffer.  I have also had issues
with org-reveal getting called in the org-roam buffer, which is why this
commit also saves the buffer it was called in.

Co-authored-by: Leo Okawa Ericson <git@relevant-information.com>
2023-11-23 21:21:08 -05:00
StrawberryTea
3cafa0223e
fix(org): check org-fold-outline in invisible property
Fix: #7206
2023-09-06 14:27:35 +02:00
AlessandroW
d156e58577
fix(org): respect org-insert-heading-hook in +org--insert-item
Doom replaces `org-insert-heading`, but its replacement does not respect
`org-insert-heading-hook`. This commit fixes that, enabling folks to
customize their insert-heading behavior, e.g.  adding a time stamp:

  (defun my/org-set-creation-date-heading-property ()
    (save-excursion
      (org-back-to-heading)
      (org-set-property "CREATED" (format-time-string "[%Y-%m-%d %T]"))))
  (add-hook 'org-insert-heading-hook #'my/org-set-creation-date-heading-property)

Ref: https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org.el#n6187
Ref: https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org.el#n1615
2022-09-16 13:14:36 +02:00
Henrik Lissner
ad6a3d0f33
refactor: deprecate featurep! for modulep!
featurep! will be renamed modulep! in the future, so it's been
deprecated. They have identical interfaces, and can be replaced without
issue.

featurep! was never quite the right name for this macro. It implied that
it had some connection to featurep, which it doesn't (only that it was
similar in purpose; still, Doom modules are not features). To undo such
implications and be consistent with its namespace (and since we're
heading into a storm of breaking changes with the v3 release anyway),
now was the best opportunity to begin the transition.
2022-08-14 20:43:35 +02:00
Valentin Herrmann
2d108e14a2
fix(org): multiple fixes for +org--insert-item
There are multiple problems with the previous version of
`+org--insert-item', e.g. the labels of ordered lists were not updated
and it also made a difference if the point is before or after the
bullet.

This commit fixes this behavior, but uses a horrible hack. For the edge
case of an empty item, it inserts a no-break space momentarily, so that
`org-insert-item' does the right thing.
2022-03-30 20:06:40 +02:00
Henrik Lissner
9217bb81f4 fix(org): org-babel-do-in-edit-buffer deleting popups
Fix: #6061
2022-02-10 21:28:55 +01:00
Henrik Lissner
9672dbcb5e refactor(org): name anonymous keybind on RET
Makes it easier to advise, swap, or reference.
2022-02-10 21:07:20 +01:00
Valentin Herrmann
26040c6fc1 fix(org): parity for headlines & items in +org--insert-item 2022-02-09 20:00:37 +01:00
Siddharth Shekar
4cc82bb32a docs(org): update docstring for +org/dwim-at-point 2022-02-09 15:58:10 +01:00
Siddharth Shekar
008b080b45 fix(org): toggle image when point before first heading 2022-02-09 15:58:10 +01:00
Henrik Lissner
67a9573f0d fix(org): tab not invoking cdlatex-tab in headings
In org-mode, if one writes a math expression in a section (i.e. heading)
while using cdlatex, pressing tab indents the section instead of
performing a cdlatex-tab.

This fix takes care of this issue to have the wanted behavior: if in
math environment and hit tab while in section, execute cdlatex-tab.

Close: #5926
Co-authored-by: roiholtzman <roiholtzman@users.noreply.github.com>
2022-01-03 16:51:51 +01:00
Henrik Lissner
798df6bc9e feat(org): follow citations on +org/dwim-at-point
As discussed in #5290, pressing RET on citations (or citation
references) will now follow them.

Ref: #5290
2021-11-25 01:22:58 +01:00
Henrik Lissner
cd87cc0cc8 refactor: remove redundant org code
org-collect-keywords does the job here. No need to reinvent the wheel.
2021-07-28 12:42:22 -04:00
Henrik Lissner
ce905b9246 Expand latex snippets in org-mode fragments on TAB 2021-07-25 15:41:29 -04:00
Henrik Lissner
60b595321e Lazy-load yasnippet harder for faster first-file load time
+ Rather than waiting for the first "interactive" major mode to be
  visited to activate yas-minor-mode, we wait until the first time the
  user invokes a snippet command to activate yas-global-mode.
+ yas-reload-all is one of the bottlenecks when loading a file for the
  first time. Deferring it further should help with this.
+ yas-global-mode reaches more major modes than our former list of
  hooks (fixes #5140).

Closes #5140
2021-06-05 13:12:00 -04:00
Henrik Lissner
805810b95f lang/org: tab = cycle folds if in emacs state
Tab should only be changed for evil users in insert mode, since they
have fold cycling functionality available in normal mode and vanilla
users do not.
2021-05-31 14:22:54 -04:00
Henrik Lissner
1d155d0c2f lang/org: reveal ancestors of point after saveplace
When opening an org file and the point is placed in a folded region (by
saveplace), it reveals the current subtree. Instead, it will reveal the
current subtree *and* its ancestors (and their siblings), which is more
intuitive.
2021-04-21 21:45:04 -04:00
Henrik Lissner
aafed6d8a0 lang/org: call push-button on buttons in org-mode 2021-03-22 01:24:26 -04:00
Henrik Lissner
d149c59d2e
Add emacs mode checks to insert mode checks
This is to accommodate users who default to emacs mode, rather than
insert mode. The two are also very alike, so many of these checks should
apply to both (almost) equally.
2020-12-11 17:38:09 -05:00
Henrik Lissner
68b1594553
Fix #4220: void-function org-clocking-p
On first invocation of +org/toggle-last-clock, before org-clock has
loaded.
2020-11-06 02:29:37 -05:00
Henrik Lissner
91ab02951d
Minor refactors across the board 2020-08-20 03:43:50 -04:00
Henrik Lissner
14d9786360
Respect org-hierarchical-todo-statistics 2020-08-14 00:40:32 -04:00
Henrik Lissner
8ae0e79918
lang/org: add eval handler
With this, gr and gR will now work in babel blocks to execute a subset
of the block (or the whole thing, if you'd like). Results are displayed
in a popup buffer (or overlay if :tools (eval +overlay) is enabled).
2020-08-05 18:26:07 -04:00
Henrik Lissner
863eb82efd
S-RET -> insert literal newline
A convention on many text editors and applications is to make RET
auto-indent new lines. That has already been done. Another convention is
for S-RET to insert an unindented line; this commit adds this convention
to Doom.

Relevant to #3694
2020-08-05 18:26:06 -04:00
Henrik Lissner
d81ef69525
Fix #3693: don't unfold archive trees on file-open
Also refactors +org-make-last-point-visible-h to be more realistic about
when it should and shouldn't expand the hidden region at point. Since
org-agenda-inhibit-startup is now non-nil by default it makes no sense
to test it (and it was a poor choice to begin with).

Plus, instead of using outline's API, better to use org's, even if
they're aliases or wrappers. Less of a maintenance burden.
2020-08-05 15:00:34 -04:00
Henrik Lissner
0e73297707
lang/org: fix edge case in +org--insert-item 2020-07-27 03:07:04 -04:00
Henrik Lissner
b2e11f9a72
Revise docstrings for org hooks 2020-07-26 16:17:04 -04:00
Henrik Lissner
12e414be89
Rename +org/toggle-clock -> +org/toggle-last-clock
And rewrite it to ask for confirmation before clocking in on the item at
point. Without this, it's much harder to see what exactly it's doing.
2020-07-26 15:55:11 -04:00
Henrik Lissner
076cee4e89
Revise +org--insert-item
Which powers +org/insert-item-below and +org/insert-item-above.
2020-07-26 15:44:42 -04:00
Henrik Lissner
afcf56a610
Redesign dwim RET on org headings
In an effort to make +org/dwim-at-point more useful and intuitive.

- Fix latex preview toggling in subtree
- Toggle inline images more selectively
- Clean up after itself (delete overlays)
- Update +org/dwim-at-point docstring
- Always update todo statistics, cookies, checkbox counts and ToC.
2020-07-24 19:27:50 -04:00
Henrik Lissner
8e34998433
Fix #3254: RET not invoking org-goto-ret in org-goto buffer 2020-05-31 22:25:55 -04:00
Henrik Lissner
ea18c83c0a
General refactors & reformatting across the board 2020-05-15 01:44:53 -04:00
Henrik Lissner
a10c157d87
Fix zr, zm, zR & zM vimmish folding in org-mode
Fixes the following keybinds for evil users:

z r        open next level of headings buffer-wide
z m        close next level of headings buffer-wide
z R        open all folded headings
z M        close all folded headings
[N] z R    open all headings at level N and above
[N] z M    close all headings at level N and below
2020-05-13 19:31:09 -04:00
Henrik Lissner
31e4bfb2d4
Don't unfold to 2nd level in org-mode by default
This is too opinionated to be a default, and has thus been replaced with
"unfold subtree around point when opening an org file", in case
saveplace has restored the point to a folded region.
2020-05-11 03:00:08 -04:00
Henrik Lissner
7662de55d8
Fix yasnippet breaking org-superstar
Because yasnippet has a delete first and ask never policy for cleaning
up overlays in the buffer.
2020-04-17 02:41:10 -04:00
Henrik Lissner
f02d28543b
Remove reference to org-bullets
Package was replaced in 5c4f3c62a
2020-04-15 18:21:50 -04:00
Henrik Lissner
169fe6a7f4
lang/org: revise docstrings 2020-04-14 15:37:00 -04:00
Henrik Lissner
da427a1b95
Fix #2880: RET on links in other elements 2020-04-11 14:43:58 -04:00
Nikodemus Siivola
8332daccee make +org--insert-item respect emacs-mode
No change of behaviour in non-emacs modes, but in emacs-mode stays there
   instead of switching to insert-mode.
2020-01-25 19:38:33 +02:00
Henrik Lissner
d84df72364
Dumb indent on TAB when in middle of subtree 2020-01-01 21:19:22 -05:00
Henrik Lissner
07823d00a7
Fix yasnippet expansion in org src blocks
This is hacky, and causes weirdness with org-bullets-mode, but it works.
2020-01-01 21:19:22 -05:00
Henrik Lissner
b9f90b3a1a
lang/org: clear src block results on TAB
When cursor is inside a src block. e.g.

  #+BEGIN_SRC elisp  <-- not here
  (message "hi")     <-- in here
  #+END_SRC          <-- not here
2019-12-30 00:07:19 -05:00
Henrik Lissner
73d975de6c
lang/org: make C-RET create headings instead of error 2019-12-20 02:13:11 -05:00
Henrik Lissner
6cf17b1237
config/default: rebind 'SPC n {c,C,n,S}'
'SPC n c' -> Toggle last org clock
'SPC n C' -> Cancel current org clock
'SPC n n' -> org-capture
'SPC n S' -> Search org-directory headings

Closes #2043
2019-12-06 13:38:57 -05:00
Henrik Lissner
26c8f5c6ef
Bytecompiler bytecompiler, won't you shut up 2019-11-23 01:21:25 -05:00
Henrik Lissner
30f72da02a
Fix No such file org-version.el errors #2010
We generate an org-version.el file, rendering our old org-release hacks
unnecessary. This may cause breakages for uses who do deep clones of
org-plus-contrib; needs testing.
2019-11-19 20:29:22 -05:00
Henrik Lissner
7879a93081
lang/org: preserve TODO keyword on C-RET
Rather than reverting to first TODO keyword.
2019-11-12 15:24:02 -05:00
Henrik Lissner
f70f788df3
lang/org: don't auto-demote headings on C-RET
This can be harder to predict. Instead, use TAB and S-TAB after-the-fact
to adjust heading level.
2019-11-12 15:24:01 -05:00
Henrik Lissner
4703992002
Suppress missing-file org-version errors 2019-11-04 00:37:25 -05:00