diff options
author | Yuchen Pei <id@ypei.org> | 2024-12-22 16:37:44 +1100 |
---|---|---|
committer | Yuchen Pei <id@ypei.org> | 2024-12-22 16:37:44 +1100 |
commit | c997f63695502f1160524b2e76ea7358ad341bb1 (patch) | |
tree | 9c80ba1c271b710c230b31ca9e432c7f0618418c /emacs | |
parent | 76865e3e10a28c024275511e2348fb1b702650ce (diff) |
[emacs] [bashrc] Multiple changes
- use custom mastodon.el
- turn off flyspell in org-jira mode because it slows down
significantly
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/.emacs.d/init/ycp-prog.el | 1 | ||||
-rw-r--r-- | emacs/.emacs.d/init/ycp-web.el | 11 | ||||
m--------- | emacs/.emacs.d/lisp/mastodon.el | 0 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-libgen.el | 21 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-prog.el | 55 |
5 files changed, 80 insertions, 8 deletions
diff --git a/emacs/.emacs.d/init/ycp-prog.el b/emacs/.emacs.d/init/ycp-prog.el index f77a8bd..9eff2f8 100644 --- a/emacs/.emacs.d/init/ycp-prog.el +++ b/emacs/.emacs.d/init/ycp-prog.el @@ -112,6 +112,7 @@ ;; Don't make this a general comint-mode hook, as it will overwrite ;; bash history rather than append to it. (add-hook 'gud-mode-hook 'my-comint-add-write-history-hook) + (my-override gdb-frame-handler) ) (my-package my-prog diff --git a/emacs/.emacs.d/init/ycp-web.el b/emacs/.emacs.d/init/ycp-web.el index 7521afd..b1e546c 100644 --- a/emacs/.emacs.d/init/ycp-web.el +++ b/emacs/.emacs.d/init/ycp-web.el @@ -212,7 +212,10 @@ (add-hook 'org-jira-mode-hook (lambda () (setq show-trailing-whitespace nil))) (add-hook 'org-jira-mode-hook - 'turn-off-auto-fill) ) + 'turn-off-auto-fill) + (add-hook 'org-jira-mode-hook + 'turn-off-flyspell) + ) (my-package eww (:delay 60) @@ -279,9 +282,9 @@ (:delay 60) (require 'sx-load)) -;; mastodon +;; mastodon.el +(add-to-list 'load-path (locate-user-emacs-file "lisp/mastodon.el/lisp")) (my-package mastodon - (:install t) (my-setq-from-local mastodon-active-user mastodon-instance-url) ;; auto fill is a bit glitchy when composing a toot (add-hook 'mastodon-toot-mode-hook (lambda () (turn-off-auto-fill))) @@ -303,7 +306,7 @@ (:delay 60) (require 'my-utils) (my-setq-from-local my-libgen-hosts my-libgen-alt-hosts - my-libgen-library-hosts + my-libgen-library-hosts my-libgen-onion-host ) (setq my-libgen-download-dir my-document-incoming-dir) (my-libgen-set-random-hosts)) diff --git a/emacs/.emacs.d/lisp/mastodon.el b/emacs/.emacs.d/lisp/mastodon.el new file mode 160000 +Subproject d8ef4fff34862ff3cef76ea704b8c4c6c7d7508 diff --git a/emacs/.emacs.d/lisp/my/my-libgen.el b/emacs/.emacs.d/lisp/my/my-libgen.el index 92a6b61..6b65eb1 100644 --- a/emacs/.emacs.d/lisp/my/my-libgen.el +++ b/emacs/.emacs.d/lisp/my/my-libgen.el @@ -144,14 +144,27 @@ (alist-get 'extension info)))) (defvar my-libgen-download-dir "~/Downloads") + +(defvar my-libgen-onion-host nil) +(defun my-libgen-make-download-link-library (info) + (car (link-gopher-get-all-links + (format "%s/main/%s" my-libgen-library-host + (alist-get 'md5 info)) + (format "\\.%s$" (alist-get 'extension info))))) + +(defun my-libgen-make-download-link-onion (info) + (let ((id-head (substring (alist-get 'id info) 0 -3))) + (format "%s/LG/%s%s/%s" + my-libgen-onion-host + (make-string (- 4 (length id-head)) ?0) + id-head + (downcase (alist-get 'md5 info))))) + (defun my-libgen-download-action () (interactive) (let ((info (get-text-property (point) 'button-data))) (my-wget-async - (car (link-gopher-get-all-links - (format "%s/main/%s" my-libgen-library-host - (alist-get 'md5 info)) - (format "\\.%s$" (alist-get 'extension info)))) + (my-libgen-make-download-link-onion info) (format "%s/%s" (expand-file-name my-libgen-download-dir) (my-libgen-format-filename info))))) diff --git a/emacs/.emacs.d/lisp/my/my-prog.el b/emacs/.emacs.d/lisp/my/my-prog.el index ffb0d26..396d919 100644 --- a/emacs/.emacs.d/lisp/my/my-prog.el +++ b/emacs/.emacs.d/lisp/my/my-prog.el @@ -367,6 +367,61 @@ left and the source buffer on the right. (defun my-gud-comint-set-prompt-regexp () (setq comint-prompt-regexp "\\((rr)|(gdb)\\) ")) + +;;; used to override `gdb-frame-handler': do not re-display frame on +;;; completion. +(defun my-gdb-frame-handler () + "Set `gdb-selected-frame' and `gdb-selected-file' to show +overlay arrow in source buffer." + (let ((frame (gdb-mi--field (gdb-mi--partial-output) 'frame))) + (when frame + (setq gdb-selected-frame (gdb-mi--field frame 'func)) + (setq gdb-selected-file + (when-let ((full (gdb-mi--field frame 'fullname))) + (file-local-name full))) + (setq gdb-frame-number (gdb-mi--field frame 'level)) + (setq gdb-frame-address (gdb-mi--field frame 'addr)) + (let ((line (gdb-mi--field frame 'line))) + (setq gdb-selected-line (and line (string-to-number line))) + (when (and gdb-selected-file gdb-selected-line + (not (and (boundp 'gud-gdb-fetch-lines-break) + gud-gdb-fetch-lines-break))) + (setq gud-last-frame (cons gdb-selected-file gdb-selected-line)) + (gud-display-frame))) + (if gud-overlay-arrow-position + (let ((buffer (marker-buffer gud-overlay-arrow-position)) + (position (marker-position gud-overlay-arrow-position))) + (when buffer + (with-current-buffer buffer + (setq fringe-indicator-alist + (if (string-equal gdb-frame-number "0") + nil + '((overlay-arrow . hollow-right-triangle)))) + (setq gud-overlay-arrow-position (make-marker)) + (set-marker gud-overlay-arrow-position position)))))))) + + +;;; Can't override gud-gdbmi-completions - would get: +;;; error in process filter: gud-marker-filter: Symbol’s value as variable is void: gud-gdb-fetch-lines-string +;;; error in process filter: Symbol’s value as variable is void: gud-gdb-fetch-lines-string + +;; (defun gud-gdbmi-completions (context command) +;; "Completion table for GDB/MI commands. +;; COMMAND is the prefix for which we seek completion. +;; CONTEXT is the text before COMMAND on the line." +;; (let ((gud-gdb-fetch-lines-in-progress t) +;; (gud-gdb-fetch-lines-string nil) +;; (gud-gdb-fetch-lines-break (length context)) +;; (gud-gdb-fetched-lines nil) +;; ;; This filter dumps output lines to `gud-gdb-fetched-lines'. +;; (gud-marker-filter #'gud-gdbmi-fetch-lines-filter)) +;; (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) +;; (gdb-input (concat "complete " context command) +;; (lambda () (setq gud-gdb-fetch-lines-in-progress nil))) +;; (while gud-gdb-fetch-lines-in-progress +;; (accept-process-output (get-buffer-process gud-comint-buffer) 1))) +;; (gud-gdb-completions-1 gud-gdb-fetched-lines))) + ;;; which-func (defun my-copy-which-func () (interactive) |