From 1cd425c2b1f270ab89b988fa96f39bb0fe32b918 Mon Sep 17 00:00:00 2001 From: Emmet Date: Tue, 15 Apr 2025 09:03:54 -0500 Subject: [PATCH] emacs fixes --- modules/user/emacs/init.el | 126 +++++++++++++++++++------------------ 1 file changed, 66 insertions(+), 60 deletions(-) diff --git a/modules/user/emacs/init.el b/modules/user/emacs/init.el index c9fe5f85..f415df6c 100644 --- a/modules/user/emacs/init.el +++ b/modules/user/emacs/init.el @@ -790,67 +790,73 @@ (interactive "p") (dotimes (_ count) (+org--insert-item 'above))) - ;;;###autoload - (defun +org-indent-maybe-h () - "Indent the current item (header or item), if possible. - Made for `org-tab-first-hook' in evil-mode." - (interactive) - (cond ((not (and (bound-and-true-p evil-local-mode) - (evil-insert-state-p))) - nil) - ((and (bound-and-true-p org-cdlatex-mode) - (or (org-inside-LaTeX-fragment-p) - (org-inside-latex-macro-p))) - nil) - ((org-at-item-p) - (org-indent-item-tree) - t) - ((org-at-heading-p) - (ignore-errors - (org-demote) - t) - ((org-in-src-block-p t) - (save-window-excursion - (org-babel-do-in-edit-buffer - (call-interactively #'indent-for-tab-command))) - t) - ((and (save-excursion - (skip-chars-backward " \t") - (bolp)) - (org-in-subtree-not-table-p)) - (call-interactively #'tab-to-tab-stop) - t)))) +(defun +org-indent-maybe-h () + "Indent the current item (header or item), if possible. +Made for `org-tab-first-hook' in evil-mode." + (interactive) + (cond ((not (and (bound-and-true-p evil-local-mode) + (evil-insert-state-p))) + nil) + ((and (bound-and-true-p org-cdlatex-mode) + (or (org-inside-LaTeX-fragment-p) + (org-inside-latex-macro-p))) + nil) + ((org-at-item-p) + (if (eq this-command 'org-shifttab) + (org-outdent-item-tree) + (org-indent-item-tree)) + t) + ((org-at-heading-p) + (ignore-errors + (if (eq this-command 'org-shifttab) + (org-promote) + (org-demote))) + t) + ((org-in-src-block-p t) + (save-window-excursion + (org-babel-do-in-edit-buffer + (call-interactively #'indent-for-tab-command))) + t) + ((and (save-excursion + (skip-chars-backward " \t") + (bolp)) + (org-in-subtree-not-table-p)) + (call-interactively #'tab-to-tab-stop) + t))) - ;;;###autoload - (defun +org-reverse-indent-maybe-h () - "Indent the current item (header or item), if possible. - Made for `org-tab-first-hook' in evil-mode." - (interactive) - (cond ((not (and (bound-and-true-p evil-local-mode) - (evil-insert-state-p))) - nil) - ((and (bound-and-true-p org-cdlatex-mode) - (or (org-inside-LaTeX-fragment-p) - (org-inside-latex-macro-p))) - nil) - ((org-at-item-p) - (org-outdent-item-tree) - t) - ((org-at-heading-p) - (ignore-errors - (org-promote) - t) - ((org-in-src-block-p t) - (save-window-excursion - (org-babel-do-in-edit-buffer - (call-interactively #'indent-for-tab-command))) - t) - ((and (save-excursion - (skip-chars-backward " \t") - (bolp)) - (org-in-subtree-not-table-p)) - (call-interactively #'tab-to-tab-stop) - t))))) +(defun +org-reverse-indent-maybe-h () + "Indent the current item (header or item), if possible. +Made for `org-tab-first-hook' in evil-mode." + (interactive) + (cond ((not (and (bound-and-true-p evil-local-mode) + (evil-insert-state-p))) + nil) + ((and (bound-and-true-p org-cdlatex-mode) + (or (org-inside-LaTeX-fragment-p) + (org-inside-latex-macro-p))) + nil) + ((org-at-item-p) + (if (eq this-command 'org-shifttab) + (org-outdent-item-tree) + (org-outdent-item-tree)) + t) + ((org-at-heading-p) + (ignore-errors + (if (eq this-command 'org-shifttab) + (org-promote) + (org-promote))) + t) + ((org-in-src-block-p t) + (save-window-excursion + (org-babel-do-in-edit-buffer + (call-interactively #'indent-for-tab-command))) + t) + ((and (save-excursion + (skip-chars-forward " \t") + (bolp)) + (org-in-subtree-not-table-p)) + (call-interactively #'tab-to-tab-stop) + t)))) (use-package org-roam :after (org)