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 /emacs/.emacs.d/lisp/my | |
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
Diffstat (limited to 'emacs/.emacs.d/lisp/my')
-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 |
4 files changed, 26 insertions, 8 deletions
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) |