summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-04-19 15:46:31 -0500
committerCase Duckworth2021-04-19 15:46:31 -0500
commit2f35181b9ae81aba268a3770113a0482364ce8ea (patch)
treecf2d75449a04ff7a869a0ab18325395000a3f984
parentMerge branch 'main' of https://tildegit.org/acdw/emacs (diff)
downloademacs-2f35181b9ae81aba268a3770113a0482364ce8ea.tar.gz
emacs-2f35181b9ae81aba268a3770113a0482364ce8ea.zip
Tweak `org-table-copy-down'
Now <S-return> will do its regular thing /in/ a table, but will also work
/outside/ a table as a regular <return>.
-rw-r--r--init.el3
-rw-r--r--lisp/acdw-org.el10
2 files changed, 11 insertions, 2 deletions
diff --git a/init.el b/init.el index e8ec188..44bbefd 100644 --- a/init.el +++ b/init.el
@@ -394,7 +394,8 @@
394 org-startup-truncated nil 394 org-startup-truncated nil
395 org-tags-column (- 0 fill-column -3) 395 org-tags-column (- 0 fill-column -3)
396 org-directory "~/org") 396 org-directory "~/org")
397 (:bind "RET" unpackaged/org-return-dwim) 397 (:bind "RET" unpackaged/org-return-dwim
398 "<S-return>" acdw-org/org-table-copy-down)
398 (add-hook 'before-save-hook #'acdw/hook--org-mode-fix-blank-lines) 399 (add-hook 'before-save-hook #'acdw/hook--org-mode-fix-blank-lines)
399 (advice-add 'org-delete-backward-char :override #'acdw-org/delete-backward-char)) 400 (advice-add 'org-delete-backward-char :override #'acdw-org/delete-backward-char))
400 401
diff --git a/lisp/acdw-org.el b/lisp/acdw-org.el index c4431ab..46497f6 100644 --- a/lisp/acdw-org.el +++ b/lisp/acdw-org.el
@@ -212,7 +212,7 @@ appropriate. In tables, insert a new row or end the table."
212 title) 212 title)
213 213
214 214
215;;; ADVICE 215;;; ADVICE AND TWEAKS
216 216
217;; Correct `org-delete-backward-char' to use `backward-delete-char-untabify' 217;; Correct `org-delete-backward-char' to use `backward-delete-char-untabify'
218(defun acdw-org/delete-backward-char (N) 218(defun acdw-org/delete-backward-char (N)
@@ -236,4 +236,12 @@ the deletion might narrow the column."
236 (backward-delete-char-untabify N) 236 (backward-delete-char-untabify N)
237 (org-fix-tags-on-the-fly)))) 237 (org-fix-tags-on-the-fly))))
238 238
239(defun acdw-org/org-table-copy-down (n)
240 "Like `org-table-copy-down', except instead of erroring when
241 that command makes no sense, just call `org-return'."
242 (interactive "p")
243 (if (org-table-check-inside-data-field 'noerror)
244 (org-table-copy-down n)
245 (unpackaged/org-return-dwim n)))
246
239(provide 'acdw-org) 247(provide 'acdw-org)