From bd7c33b39527f3cea1c7f5270fc60a979357a318 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Sun, 30 Jul 2023 16:23:47 +1000 Subject: Some small changes. visual line mode, bbdb mua, org agenda, org capture, xref, bbdb --- emacs/.emacs.d/lisp/my/my-bbdb.el | 2 +- emacs/.emacs.d/lisp/my/my-prog.el | 45 ++------------------------------------- 2 files changed, 3 insertions(+), 44 deletions(-) (limited to 'emacs/.emacs.d/lisp') diff --git a/emacs/.emacs.d/lisp/my/my-bbdb.el b/emacs/.emacs.d/lisp/my/my-bbdb.el index f5aa420..91cdcde 100644 --- a/emacs/.emacs.d/lisp/my/my-bbdb.el +++ b/emacs/.emacs.d/lisp/my/my-bbdb.el @@ -179,7 +179,7 @@ If NAME exists in bbdb, update. Otherwise insert." (defun my-bbdb-done () "Save and quit bbdb window" (interactive) - (bbdb-save) (quit-window)) + (bbdb-save) (delete-window)) (defun my-bbdb-all () "Dispaly all bbdb records" diff --git a/emacs/.emacs.d/lisp/my/my-prog.el b/emacs/.emacs.d/lisp/my/my-prog.el index 96ffac2..a38f956 100644 --- a/emacs/.emacs.d/lisp/my/my-prog.el +++ b/emacs/.emacs.d/lisp/my/my-prog.el @@ -73,7 +73,7 @@ (error "I don't know how to restart in %S" major-mode)) ) -(defun my-shell-disable-company-if-remote () +(defun my-shell-disable-company-if-remote () (when (and (fboundp 'company-mode) (file-remote-p default-directory)) (company-mode -1))) @@ -122,48 +122,7 @@ ;; second condition - the extension is "c" or "cpp" ((member ext '("c" "cpp" "cc")) (when (file-exists-p (setq new-file (concat bse ".h"))) - (find-file new-file)))))) - -;;; To override `xref-query-replace-in-results'. -(defun my-xref-query-replace-in-results (from to) - "Perform interactive replacement of FROM with TO in all displayed xrefs. - -This function interactively replaces FROM with TO in the names of the -references displayed in the current *xref* buffer. - -When called interactively, it uses '.*' as FROM, which means replace -the whole name, and prompts the user for TO. -If invoked with prefix argument, it prompts the user for both FROM and TO. - -As each match is found, the user must type a character saying -what to do with it. Type SPC or `y' to replace the match, -DEL or `n' to skip and go to the next match. For more directions, -type \\[help-command] at that time. - -Note that this function cannot be used in *xref* buffers that show -a partial list of all references, such as the *xref* buffer created -by \\[xref-find-definitions] and its variants, since those list only -some of the references to the identifiers." - (interactive - (let* ((fr - (if current-prefix-arg - (read-regexp "Query-replace (regexp)" ".*") - "\\(.*\\)")) - (prompt (if current-prefix-arg - (format "Query-replace (regexp) %s with: " fr) - "Query-replace all matches with: "))) - (list fr (read-regexp prompt)))) - (let* (item xrefs iter) - (save-excursion - (while (setq item (xref--search-property 'xref-item)) - (when (xref-match-length item) - (push item xrefs)))) - (unwind-protect - (progn - (goto-char (point-min)) - (setq iter (xref--buf-pairs-iterator (nreverse xrefs))) - (xref--query-replace-1 from to iter)) - (funcall iter :cleanup)))) + (find-file new-file)))))) (defun my-set-tab-width-to-8 () (interactive) -- cgit v1.2.3