aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2023-08-19 20:57:55 +1000
committerYuchen Pei <id@ypei.org>2023-08-19 20:57:55 +1000
commit180b941004c96f16ef6b6d7a1c57d80cde146673 (patch)
treef658e1720a1e3fcf52740b7f2184f773ed040396
parent011a8eb2f09be60d37bc8db2f258a96bfa97bf0e (diff)
make my-new-line commands indent
-rw-r--r--emacs/.emacs.d/lisp/my/my-editing.el16
1 files changed, 6 insertions, 10 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-editing.el b/emacs/.emacs.d/lisp/my/my-editing.el
index 0b953b3..6bbde62 100644
--- a/emacs/.emacs.d/lisp/my/my-editing.el
+++ b/emacs/.emacs.d/lisp/my/my-editing.el
@@ -136,16 +136,11 @@ current line or active region without adding it to the `kill-ring'."
(message "Copied current %s" message))))
;;;###autoload
-(defun my-new-line-below (&optional arg)
- "Create an empty line below the current one.
-Move the point to the absolute beginning. Adapt indentation by
-passing optional prefix ARG (\\[universal-argument]). Also see
-`my-new-line-above'."
- (interactive "P")
+(defun my-new-line-below ()
+ "Open a new line below and indent."
+ (interactive)
(end-of-line)
- (if arg
- (newline-and-indent)
- (newline)))
+ (newline-and-indent))
;;;###autoload
(defun my-new-line-above-or-below (&optional arg)
@@ -160,7 +155,8 @@ by passing optional prefix ARG (\\[universal-argument])."
(progn
(beginning-of-line)
(newline)
- (forward-line -1))
+ (forward-line -1)
+ (indent-according-to-mode))
(forward-line -1)
(my-new-line-below))))