aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp/my
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/.emacs.d/lisp/my')
-rw-r--r--emacs/.emacs.d/lisp/my/my-editing.el27
-rw-r--r--emacs/.emacs.d/lisp/my/my-magit.el8
2 files changed, 35 insertions, 0 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-editing.el b/emacs/.emacs.d/lisp/my/my-editing.el
index f8e405e..b24103f 100644
--- a/emacs/.emacs.d/lisp/my/my-editing.el
+++ b/emacs/.emacs.d/lisp/my/my-editing.el
@@ -481,5 +481,32 @@ With an prefix-arg, copy the file name relative to project root."
(goto-char (point-min))
(forward-line (1- line-number))))))
+(defun my-mark-backward-up-list ()
+ "Mark the sexp containing the current one."
+ (interactive)
+ (backward-up-list)
+ (activate-mark)
+ (set-mark (point))
+ (forward-sexp)
+ (exchange-point-and-mark))
+
+(defun my-kill-sexp-or-comment (&optional n)
+ "Kill the next n sexp. On failure, call `comment-kill' instead."
+ (interactive)
+ (condition-case _
+ (kill-sexp n)
+ (scan-error (comment-kill (or n 1)))))
+
+(defun my-mark-sexp-or-comment ()
+ "Mark the next sexp or comment."
+ (interactive)
+ (condition-case _
+ (mark-sexp)
+ (user-error
+ (set-mark
+ (save-excursion
+ (forward-comment 1)
+ (point))))))
+
(provide 'my-editing)
;;; my-editing.el ends here
diff --git a/emacs/.emacs.d/lisp/my/my-magit.el b/emacs/.emacs.d/lisp/my/my-magit.el
index c6fc0f6..efb3c84 100644
--- a/emacs/.emacs.d/lisp/my/my-magit.el
+++ b/emacs/.emacs.d/lisp/my/my-magit.el
@@ -67,5 +67,13 @@
(replace-regexp-in-string "/build\\>.*" "/src"
default-directory))))
+(defun my-magit-ignore-other-worktrees (rev-and-args)
+ "Add --ignore-other-worktrees to the second element of REV-AND-ARGS.
+
+For use as a :filter-args advice"
+ (pcase-let ((`(,revision ,args) rev-and-args))
+ (list revision
+ (cons "--ignore-other-worktrees" args))))
+
(provide 'my-magit)
;;; my-magit.el ends here