aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2024-04-05 09:12:32 +1100
committerYuchen Pei <id@ypei.org>2024-04-05 09:12:32 +1100
commit25f0fe5d68ebec67f3a1ca2f24c4a0bc8e49381f (patch)
tree94f54c59a0116949d2ee2342e54d91185f2c5367 /emacs/.emacs.d/lisp
parent5e5406f6b1b47b84591ee9dea4233164e9a55fb0 (diff)
[emacs][urxvt] bunch of small changes
- add org clock string to frame title - add ansi color to compilation buffer - look for project source dir from build dir - fix my-kill-sexp-or-comment - more lines in urxvt
Diffstat (limited to 'emacs/.emacs.d/lisp')
-rw-r--r--emacs/.emacs.d/lisp/my/my-editing.el9
-rw-r--r--emacs/.emacs.d/lisp/my/my-gnus.el2
-rw-r--r--emacs/.emacs.d/lisp/my/my-mariadb.el14
-rw-r--r--emacs/.emacs.d/lisp/my/my-project.el10
4 files changed, 26 insertions, 9 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-editing.el b/emacs/.emacs.d/lisp/my/my-editing.el
index 2c1abfb..aa65ba1 100644
--- a/emacs/.emacs.d/lisp/my/my-editing.el
+++ b/emacs/.emacs.d/lisp/my/my-editing.el
@@ -493,9 +493,12 @@ With an prefix-arg, copy the file name relative to project root."
(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)))))
+ (let ((old-max (point-max))
+ (old-point (point)))
+ (comment-kill (or n 1))
+ (when (= old-max (point-max))
+ (goto-char old-point)
+ (kill-sexp n))))
(defun my-mark-sexp-or-comment ()
"Mark the next sexp or comment."
diff --git a/emacs/.emacs.d/lisp/my/my-gnus.el b/emacs/.emacs.d/lisp/my/my-gnus.el
index 599a19c..e44e9c8 100644
--- a/emacs/.emacs.d/lisp/my/my-gnus.el
+++ b/emacs/.emacs.d/lisp/my/my-gnus.el
@@ -167,7 +167,7 @@ The archiving target comes from `my-gnus-group-alist'."
(defun my-gnus-start ()
(interactive)
(let ((buffer (get-buffer "*Group*")))
- (if buffer
+ (if buffer
(switch-to-buffer "*Group*")
(gnus))))
diff --git a/emacs/.emacs.d/lisp/my/my-mariadb.el b/emacs/.emacs.d/lisp/my/my-mariadb.el
index 984cc29..52ca8bc 100644
--- a/emacs/.emacs.d/lisp/my/my-mariadb.el
+++ b/emacs/.emacs.d/lisp/my/my-mariadb.el
@@ -63,6 +63,7 @@
(replace-regexp-in-string
"/src"
"/build/mysql-test/var/log/mysqld.1.1.rr/latest-trace"
+ ;; "/build/mysql-test/var/log/mysqld.3.1.rr/latest-trace"
(project-root (project-current t))))
(expand-file-name "~/bin/gdb-mi.sh"))))
@@ -185,12 +186,15 @@
(goto-char (point-min))
(while (re-search-forward
(concat
- "\\(spider_alloc_calc_mem_init\\|init_calc_mem\\|spider_malloc\\|"
- "spider_bulk_alloc_mem\\|spider_bulk_malloc\\)"
- "\\(([^0-9)_]*\\)\\([0-9]+\\)")
+ "\\(spider_alloc_calc_mem_init(.*?, \\|init_calc_mem(\\|"
+ "spider_malloc(.*?, \\|"
+ "spider_bulk_alloc_mem(.*?, \\|spider_bulk_malloc.*?, \\)"
+ "\\([0-9]+\\)"
+ ;; "\\(([^0-9)]*\\)\\([0-9]+\\)"
+ )
nil t)
- (let ((beg (match-beginning 3))
- (end (match-end 3)))
+ (let ((beg (match-beginning 2))
+ (end (match-end 2)))
(replace-region-contents beg end #'my-mdev-32524-make-id)))
(save-buffer)))))
diff --git a/emacs/.emacs.d/lisp/my/my-project.el b/emacs/.emacs.d/lisp/my/my-project.el
index 1cf23ee..70f86dc 100644
--- a/emacs/.emacs.d/lisp/my/my-project.el
+++ b/emacs/.emacs.d/lisp/my/my-project.el
@@ -45,6 +45,16 @@
(file-name-nondirectory (directory-file-name
(project-root (project-current)))))
+(defun my-project-try-find-from-build-dir (dir)
+ "Try to find project from the build dir.
+
+To use as an item in `project-find-functions'.
+
+TODO: check whether we could use
+`project-vc-external-roots-function' instead."
+ (when (string-match-p "/build\\>.*" dir)
+ (project-current nil (replace-regexp-in-string "/build\\>.*" "/src" dir))))
+
(defvar my-licenses nil
"List of licenses in the form of (licence-id . license-text-file)")