aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp/my/my-prog.el
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2025-08-28 08:49:51 +1000
committerYuchen Pei <id@ypei.org>2025-08-28 08:49:51 +1000
commit124a2a6eaa2a8d96405168693f9c8e8afc51b10a (patch)
tree3cdfc91d93c5aec48acf6a0a31d4dc9fe30013a9 /emacs/.emacs.d/lisp/my/my-prog.el
parent4ec9311b65f343ceb9efd6709908a6e5ee44b6d7 (diff)
[emacs] misc fixes
Diffstat (limited to 'emacs/.emacs.d/lisp/my/my-prog.el')
-rw-r--r--emacs/.emacs.d/lisp/my/my-prog.el32
1 files changed, 23 insertions, 9 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-prog.el b/emacs/.emacs.d/lisp/my/my-prog.el
index 92fcf21..eead408 100644
--- a/emacs/.emacs.d/lisp/my/my-prog.el
+++ b/emacs/.emacs.d/lisp/my/my-prog.el
@@ -444,7 +444,12 @@ overlay arrow in source buffer."
(defun my-gud-watch-expr (expr)
(with-current-buffer gud-comint-buffer
- (insert "watch -l " expr)
+ (insert "wl " expr)
+ (comint-send-input)))
+
+(defun my-gud-break-expr (expr)
+ (with-current-buffer gud-comint-buffer
+ (insert "b " expr)
(comint-send-input)))
(defun my-gud-print-expr (expr)
@@ -454,11 +459,12 @@ overlay arrow in source buffer."
(defun my-gud-print-expr-region (b e)
(interactive "r")
- (unless (eq (gdb-get-source-buffer) (current-buffer))
- (error "Not in the source buffer"))
- (if current-prefix-arg
- (my-gud-watch-expr (buffer-substring b e))
- (my-gud-print-expr (buffer-substring b e))))
+ (let ((selection (buffer-substring b e)))
+ (pcase (prefix-numeric-value current-prefix-arg)
+ (16 (my-gud-break-expr selection))
+ (4 (my-gud-watch-expr selection))
+ (_ (my-gud-print-expr selection))))
+ (deactivate-mark))
;;; which-func
(defun my-copy-which-func ()
@@ -466,11 +472,19 @@ overlay arrow in source buffer."
(kill-new (which-function))
)
+(defun my-copy-with-func (b e)
+ (interactive "r")
+ (kill-new
+ (concat comment-start "in " (which-function) ":" comment-end "\n"
+ (buffer-substring b e)))
+ (deactivate-mark)
+ (message "Copied current region with function name"))
+
(defun my-set-header-line-to-which-func ()
(setq header-line-format
- '((which-func-mode
- ("" which-func-format " ")
- ))))
+ '((which-func-mode
+ ("" which-func-format " ")
+ ))))
;; override bookmark-make-record for easier default bookmark name.
(defun my-bookmark-make-record ()