aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2023-10-11 22:38:03 +1100
committerYuchen Pei <id@ypei.org>2023-10-11 22:38:03 +1100
commitad1cdc1f55bf90f635365b728b91888edf31fa6e (patch)
treece717e93afadd10b38481756c500c91e6a207269
parent24cc28936e9366e70ed89cc5ddc560b886d25d8b (diff)
[emacs] [gdb] Some minor changes
- emacs: my-elide-region that does the same thing as message-elide-region, with the comment-start as the prefix - gdbinit: an alias to a command that displays all backtrace of all threads
-rw-r--r--emacs/.emacs.d/init/ycp-editing.el3
-rw-r--r--emacs/.emacs.d/init/ycp-grep.el3
-rw-r--r--emacs/.emacs.d/lisp/my/my-editing.el11
-rw-r--r--misc/.gdbinit3
-rwxr-xr-xmisc/bin/lock.sh10
5 files changed, 28 insertions, 2 deletions
diff --git a/emacs/.emacs.d/init/ycp-editing.el b/emacs/.emacs.d/init/ycp-editing.el
index cdbe09d..b86139e 100644
--- a/emacs/.emacs.d/init/ycp-editing.el
+++ b/emacs/.emacs.d/init/ycp-editing.el
@@ -77,6 +77,7 @@
"C-x C-t" #'my-transpose-lines
"M-`" #'my-buffer-create-scratch
"C-M-;" #'my-comment-and-copy-selection
+ "C-c C-;" #'my-elide-region
"M-Q" #'my-unfill-paragraph
"C-x M-s" #'my-save-without-formatting
"C-x w" #'my-copy-url-at-point
@@ -110,8 +111,6 @@
(:delay 60))
(define-key global-map [f2] 'revert-buffer)
-(define-key global-map (kbd "C-c r r") 'replace-regexp)
-(define-key global-map (kbd "C-c r s") 'replace-string)
(my-package aggressive-indent
(:install t)
diff --git a/emacs/.emacs.d/init/ycp-grep.el b/emacs/.emacs.d/init/ycp-grep.el
index 6496c78..85f15cd 100644
--- a/emacs/.emacs.d/init/ycp-grep.el
+++ b/emacs/.emacs.d/init/ycp-grep.el
@@ -88,6 +88,9 @@
(:delay 5)
(add-hook 'occur-mode-hook #'hl-line-mode)
(my-keybind occur-mode-map "t" #'toggle-truncate-lines)
+ (advice-add 'replace-regexp :around 'my-replace-no-filter)
+ (define-key global-map (kbd "C-c r r") 'replace-regexp)
+ (define-key global-map (kbd "C-c r s") 'replace-string)
)
;;; wgrep (writable grep)
diff --git a/emacs/.emacs.d/lisp/my/my-editing.el b/emacs/.emacs.d/lisp/my/my-editing.el
index b24103f..19043ff 100644
--- a/emacs/.emacs.d/lisp/my/my-editing.el
+++ b/emacs/.emacs.d/lisp/my/my-editing.el
@@ -508,5 +508,16 @@ With an prefix-arg, copy the file name relative to project root."
(forward-comment 1)
(point))))))
+(defun my-elide-region (b e)
+ (interactive "r")
+ (let ((message-elide-ellipsis (concat comment-start
+ " [... %l lines elided]
+")))
+ (message-elide-region b e)))
+
+(defun my-replace-no-filter (old-fun &rest r)
+ (let ((search-invisible t))
+ (apply old-fun r)))
+
(provide 'my-editing)
;;; my-editing.el ends here
diff --git a/misc/.gdbinit b/misc/.gdbinit
index b1eb7d8..b2c8a1f 100644
--- a/misc/.gdbinit
+++ b/misc/.gdbinit
@@ -2,6 +2,7 @@ set print static-members off
set print frame-arguments all
# unlimited print string length
set print elements 0
+handle SIGCONT nostop
handle SIGUSR1 nostop noprint
handle SIGUSR2 nostop noprint
handle SIGWAITING nostop noprint
@@ -18,6 +19,8 @@ alias wl = watch -l
alias awl = awatch -l
alias rwl = rwatch -l
alias rt = restart
+# Print backtrace of all threads
+alias abt = thread apply all bt
set history save on
set history filename ~/.gdb_history
set history remove-duplicates unlimited
diff --git a/misc/bin/lock.sh b/misc/bin/lock.sh
new file mode 100755
index 0000000..6088b94
--- /dev/null
+++ b/misc/bin/lock.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# Take a screenshot
+scrot -o /tmp/screen_locked.png
+
+# Pixellate it 10x
+mogrify -scale 10% -scale 1000% /tmp/screen_locked.png
+
+# Lock screen displaying this image.
+i3lock -i /tmp/screen_locked.png