diff options
author | Yuchen Pei <id@ypei.org> | 2023-06-27 19:53:06 +1000 |
---|---|---|
committer | Yuchen Pei <id@ypei.org> | 2023-06-27 19:53:06 +1000 |
commit | 002c98545eb799b2293ee98459d534339739b032 (patch) | |
tree | dd58eeddee67258f02431f7de1533ef85f17d27d | |
parent | 4edc5f34347efbc4422947bde97f95918d29229e (diff) |
buncha changes
- add gdbinit
- attempt to fix tempel in eglot (not working)
- add qutebrowser to hmm browser
- allow find file to open file:line_no
-rw-r--r-- | emacs/.emacs.d/init/ycp-complete.el | 7 | ||||
-rw-r--r-- | emacs/.emacs.d/init/ycp-editing.el | 2 | ||||
-rw-r--r-- | emacs/.emacs.d/init/ycp-org.el | 10 | ||||
-rw-r--r-- | emacs/.emacs.d/init/ycp-prog.el | 2 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-editing.el | 21 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-mariadb.el | 2 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-org.el | 5 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-web.el | 6 | ||||
-rw-r--r-- | misc/.gdbinit | 30 |
9 files changed, 71 insertions, 14 deletions
diff --git a/emacs/.emacs.d/init/ycp-complete.el b/emacs/.emacs.d/init/ycp-complete.el index 4243311..fefe711 100644 --- a/emacs/.emacs.d/init/ycp-complete.el +++ b/emacs/.emacs.d/init/ycp-complete.el @@ -246,9 +246,9 @@ "<backtab>" #'tempel-previous "C-S-<iso-lefttab>" #'tempel-previous) (require 'my-tempel) - (dolist (hook '(prog-mode-hook text-mode-hook)) - (add-hook hook 'my-tempel-setup-capf)) - ) + (my-add-hooks #'my-tempel-setup-capf '(prog-mode-hook text-mode-hook)) + (add-hook 'eglot-managed-mode-hook #'my-tempel-setup-capf) + ) ;; consult-recoll (my-package consult-recoll @@ -266,6 +266,7 @@ (:name firefox :command browse-url-firefox) (:name firefox-private :command my-browse-url-firefox-private) (:name tor-browser :command my-browse-url-tor-browser) + (:name qutebrowser :command my-browse-url-qutebrowser) (:name download-and-open :command my-fetch-url))) (my-setq-from-local hmm-handlers) (setq hmm-external-handlers diff --git a/emacs/.emacs.d/init/ycp-editing.el b/emacs/.emacs.d/init/ycp-editing.el index 5ed3eca..b77f1ea 100644 --- a/emacs/.emacs.d/init/ycp-editing.el +++ b/emacs/.emacs.d/init/ycp-editing.el @@ -73,6 +73,8 @@ ) (electric-pair-mode) (my-add-hooks #'my-non-special-modes-setup '(text-mode-hook prog-mode-hook)) + (advice-add 'find-file :around 'my-find-file-line-number) + (advice-add 'find-file-other-window :around 'my-find-file-line-number) ) (setq viper-mode nil) diff --git a/emacs/.emacs.d/init/ycp-org.el b/emacs/.emacs.d/init/ycp-org.el index a5917a6..578932e 100644 --- a/emacs/.emacs.d/init/ycp-org.el +++ b/emacs/.emacs.d/init/ycp-org.el @@ -267,7 +267,7 @@ (my-package org-clock (setq org-clock-history-length 100) (setq org-clock-in-switch-to-state "DOIN") - (setq org-clock-idle-time 10) + (setq org-clock-idle-time 15) (setq org-clock-mode-line-total 'auto) (setq org-clock-persist 'history) (org-clock-persistence-insinuate)) @@ -407,7 +407,8 @@ (:delay 10) (require 'my-buffer) (add-to-list 'org-link-frame-setup - (cons 'file 'my-find-file-maybe-other-window))) + (cons 'file 'my-find-file-maybe-other-window)) + ) (my-package my-org (:delay 10) @@ -416,11 +417,14 @@ "C-c ns" #'my-org-substitute-gnus-link-after-archiving "C-x w" #'my-org-copy-link-at-point "C-'" #'my-org-store-link-and-return - "C-c M-w" #'my-org-copy-dwim + "C-c M-w" #'my-org-copy-dwim "C-c <f7>" #'my-org-open-shell-at-attach-dir "C-M-n" #'my-org-next-block-or-results "C-M-p" #'my-org-previous-block-or-results) (add-hook 'org-follow-link-hook 'my-org-follow-link-after) + ;; When in prog-mode, use line number as search item. + (add-to-list 'org-create-file-search-functions + 'my-link-to-line-number-in-prog-mode) (my-override org-insert-all-links) (my-override org-open-at-point-global) (my-override org-refile-get-targets) diff --git a/emacs/.emacs.d/init/ycp-prog.el b/emacs/.emacs.d/init/ycp-prog.el index 27d860b..003e862 100644 --- a/emacs/.emacs.d/init/ycp-prog.el +++ b/emacs/.emacs.d/init/ycp-prog.el @@ -237,6 +237,8 @@ (setq debugger-stack-frame-as-list t) (setq display-raw-bytes-as-hex t) +(setq eval-expression-print-length 300) +(setq eval-expression-print-level 10) ;;; paredit (my-package paredit diff --git a/emacs/.emacs.d/lisp/my/my-editing.el b/emacs/.emacs.d/lisp/my/my-editing.el index 2bbda27..174504d 100644 --- a/emacs/.emacs.d/lisp/my/my-editing.el +++ b/emacs/.emacs.d/lisp/my/my-editing.el @@ -110,11 +110,6 @@ (define-key global-map "\M-b" 'backward-word) (message "M-f is forward-word"))))) -(defun my-kill-line-backward () - "Kill from point to the beginning of the line." - (interactive) - (kill-line 0)) - (defun my--duplicate-buffer-substring (beg end &optional indent) "Duplicate buffer substring between BEG and END positions. With optional INDENT, run `indent-for-tab-command' after @@ -362,7 +357,7 @@ Basically move the line up (defun my-kill-line-backward (&optional arg) "Calls `my-kill-backward' or `kill-line' with 0 in case of prefix arg." (interactive "P") - (if prefix-arg + (if arg (kill-line 0) (my-kill-backward))) @@ -402,5 +397,19 @@ With an prefix-arg, copy the file name relative to project root." (setq show-trailing-whitespace t) ) +(defun my-find-file-line-number (orig filename &rest args) + "Turn files like file.cpp:14 into file.cpp and going to the 14-th line." + (save-match-data + (let* ((matched (string-match "^\\(.*\\):\\([0-9]+\\):?$" filename)) + (line-number (and matched + (match-string 2 filename) + (string-to-number (match-string 2 filename)))) + (filename (if matched (match-string 1 filename) filename))) + (apply orig filename args) + (when line-number + ;; goto-line is for interactive use + (goto-char (point-min)) + (forward-line (1- line-number)))))) + (provide 'my-editing) ;;; my-editing.el ends here diff --git a/emacs/.emacs.d/lisp/my/my-mariadb.el b/emacs/.emacs.d/lisp/my/my-mariadb.el index bc91856..a74cceb 100644 --- a/emacs/.emacs.d/lisp/my/my-mariadb.el +++ b/emacs/.emacs.d/lisp/my/my-mariadb.el @@ -37,7 +37,6 @@ (sql-send-buffer))) (defun my-gdb-maria () - (require 'ycp-gdb) (interactive) (when (and (buffer-live-p gud-comint-buffer) (get-buffer-process gud-comint-buffer)) @@ -52,7 +51,6 @@ (project-root (project-current t))))))) (defun my-gdb-maria-spider () - (require 'ycp-gdb) (interactive) (when (and (buffer-live-p gud-comint-buffer) (get-buffer-process gud-comint-buffer)) diff --git a/emacs/.emacs.d/lisp/my/my-org.el b/emacs/.emacs.d/lisp/my/my-org.el index 4b8ad44..6286918 100644 --- a/emacs/.emacs.d/lisp/my/my-org.el +++ b/emacs/.emacs.d/lisp/my/my-org.el @@ -1177,5 +1177,10 @@ When BLOCK-REGEXP is non-nil, use this regexp to find blocks." "-mode" (prin1-to-string (my-read-major-mode))))) (org-edit-special)) +(defun my-link-to-line-number-in-prog-mode () + "When in prog-mode, use line number as search item." + (when (derived-mode-p 'prog-mode) + (number-to-string (org-current-line)))) + (provide 'my-org) ;;; my-org.el ends here diff --git a/emacs/.emacs.d/lisp/my/my-web.el b/emacs/.emacs.d/lisp/my/my-web.el index c8517de..eced148 100644 --- a/emacs/.emacs.d/lisp/my/my-web.el +++ b/emacs/.emacs.d/lisp/my/my-web.el @@ -74,6 +74,12 @@ (start-process (concat "firefox-private " url) nil "firefox" "--private-window" url)) +(defun my-browse-url-qutebrowser (url) + "Browse URL with qutebrowser." + (setq url (browse-url-encode-url url)) + (start-process (concat "qutebrowser " url) nil "qutebrowser" + url)) + ;; TODO: change to using hmm matching url with default app ;; override browse-url (defun my-browse-url (url &optional arg) diff --git a/misc/.gdbinit b/misc/.gdbinit new file mode 100644 index 0000000..8923c3b --- /dev/null +++ b/misc/.gdbinit @@ -0,0 +1,30 @@ +print static-members off +set print frame-arguments all +handle SIGUSR1 nostop noprint +handle SIGUSR2 nostop noprint +handle SIGWAITING nostop noprint +handle SIGLWP nostop noprint +handle SIGPIPE nostop +handle SIGALRM nostop +handle SIGHUP nostop +handle SIGTERM nostop noprint +handle SIG32 nostop noprint +handle SIG33 nostop noprint +alias ud = undisplay +alias wl = watch -l +alias awl = awatch -l +alias rwl = rwatch -l +set history save on +set history filename ~/.gdb_history +set history remove-duplicates unlimited +set history size unlimited +set history expansion on +set print object on +alias pvtable = print /a (*(void ***)) +set unwindonsignal on +set print vtbl on +set print pretty on +# rr +alias rf = reverse-finish + +source ~/.gdbinit_local |