From 002c98545eb799b2293ee98459d534339739b032 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 27 Jun 2023 19:53:06 +1000 Subject: 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 --- emacs/.emacs.d/lisp/my/my-editing.el | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'emacs/.emacs.d/lisp/my/my-editing.el') 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 -- cgit v1.2.3