From 06914aff2b0011d41bc50447965a8d7c6ef52c9b Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 19 Jun 2023 11:19:19 +1000 Subject: precision fixes - Adding org-jira - Also fixed getting builders in buildbot - Adding gdb-mi and gud - Adding gdb and shell configs - Also mariadb dev related stuff - A few more modes - some more updates --- emacs/.emacs.d/init/ycp-buffer.el | 4 +- emacs/.emacs.d/init/ycp-client.el | 4 +- emacs/.emacs.d/init/ycp-complete.el | 75 +++++-------------------- emacs/.emacs.d/init/ycp-dired.el | 1 + emacs/.emacs.d/init/ycp-fun.el | 2 +- emacs/.emacs.d/init/ycp-gnus.el | 9 +-- emacs/.emacs.d/init/ycp-markup.el | 8 +++ emacs/.emacs.d/init/ycp-org.el | 10 +++- emacs/.emacs.d/init/ycp-prog.el | 107 ++++++++++++++++++++++++++++++++---- emacs/.emacs.d/init/ycp-project.el | 2 + emacs/.emacs.d/init/ycp-vc.el | 8 ++- emacs/.emacs.d/init/ycp-web.el | 15 ++++- 12 files changed, 156 insertions(+), 89 deletions(-) (limited to 'emacs/.emacs.d/init') diff --git a/emacs/.emacs.d/init/ycp-buffer.el b/emacs/.emacs.d/init/ycp-buffer.el index 56bcf08..91edec5 100644 --- a/emacs/.emacs.d/init/ycp-buffer.el +++ b/emacs/.emacs.d/init/ycp-buffer.el @@ -207,7 +207,7 @@ )) (setq switch-to-buffer-in-dedicated-window 'pop) - (setq window-combination-resize t) + (setq window-combination-resize nil) (my-keybind resize-window-repeat-map ">" #'enlarge-window-horizontally "<" #'shrink-window-horizontally) @@ -217,9 +217,7 @@ "C-x C-n" #'next-buffer ; override `set-goal-column' "C-x C-p" #'previous-buffer ; override `mark-page' "C-x !" #'delete-other-windows-vertically - "C-x _" #'balance-windows ; underscore "C-x -" #'fit-window-to-buffer ; hyphen - "C-x +" #'balance-windows-area "C-x }" #'enlarge-window "C-x {" #'shrink-window "C-x >" #'enlarge-window-horizontally ; override `scroll-right' diff --git a/emacs/.emacs.d/init/ycp-client.el b/emacs/.emacs.d/init/ycp-client.el index def2351..15c2710 100644 --- a/emacs/.emacs.d/init/ycp-client.el +++ b/emacs/.emacs.d/init/ycp-client.el @@ -65,8 +65,8 @@ (autoload 'global-dictionary-tooltip-mode "dictionary" "Enable/disable dictionary-tooltip-mode for all buffers" t) (my-keybind global-map - "C-c dd" #'dictionary-search - "C-c dm" #'dictionary-match-words) + "C-h y" #'dictionary-search + "C-h Y" #'dictionary-match-words) (setq dictionary-server "dict.org" dictionary-default-popup-strategy "lev" ; read doc string dictionary-create-buttons nil diff --git a/emacs/.emacs.d/init/ycp-complete.el b/emacs/.emacs.d/init/ycp-complete.el index aed7b3b..57e5667 100644 --- a/emacs/.emacs.d/init/ycp-complete.el +++ b/emacs/.emacs.d/init/ycp-complete.el @@ -111,7 +111,8 @@ "C-s" #'icomplete-forward-completions "C-r" #'icomplete-backward-completions "C-v" #'my-icomplete-vertical-forward-page - "M-v" #'my-icomplete-vertical-backward-page)) + "M-v" #'my-icomplete-vertical-backward-page + "" nil)) (my-package recentf (setq recentf-max-saved-items 1000) @@ -148,9 +149,19 @@ "C-s" #'corfu-next "C-r" #'corfu-previous) (require 'my-corfu) - (add-hook 'minibuffer-setup-hook #'my-corfu-enable-always-in-minibuffer 1) + (add-hook 'minibuffer-setup-hook + #'my-corfu-enable-always-in-minibuffer 1) +;;; corfu does not work well in gud as it "flushes" completion +;;; suggestions to the buffer + (setq corfu-exclude-modes '(gud-mode)) ) +;;; We still need company mode because corfu does not work well in gud +;;; mode yet +(my-package company + (:install t) + (:delay 5)) + ;;; cape (my-package cape (:install t) @@ -248,65 +259,7 @@ (:name firefox-private :command my-browse-url-firefox-private) (:name tor-browser :command my-browse-url-tor-browser) (:name download-and-open :command my-fetch-url))) - (setq hmm-handlers - '(:query - ((:command servall-ytdl-search) - (:command servall-wikipedia-open) - (:command servall-wikipedia-search) - (:command hcel-global-ids) - (:command osm-search) - (:command my-org-recoll-mdn) - (:command consult-recoll) - (:command locate) - (:command project-or-external-find-regexp) - (:command dictionary-search) - (:command my-libgen-search) - (:command my-libgen-search-isbn) - (:command my-openlibrary-search) - ;; TODO: sx, grep-somewhere, grep-here, gnus news, gnus email - ;; rt-liber (some sort of smart search) - ) - - ;; URL handlers handle all schemes, including file: - ;; We want to add all file-handlers here with regex that filters - ;; file: in scheme - :url - ((:schemes ("http" "https") - :regex "^en.wikipedia.org/wiki/.*$" - :command servall-wikipedia-open) - (:schemes ("http" "https") - :regex - "^\\(?:.*\\.\\)?\\(?:stackexchange\\|stackoverflow\\|mathoverflow\\|askubuntu\\)\\.com/.*$" - :command sx-open-link) - (:schemes ("http" "https") - :regex - "^\\(?:.*\\.\\)?news.ycombinator.com/.*$" - :command hnreader-comment) - (:schemes ("http" "https") - :command my-org-grok) - (:schemes ("mailto") :command browse-url-mail) - (:schemes ("mailto") :command my-gnus-fastmail-mail-url) - (:schemes ("http" "https") :command my-ytdl-audio) - (:schemes ("http" "https") :command my-ytdl-video) - (:schemes ("http" "https") :command my-describe-package-from-url - :regex - "^\\(?:elpa.gnu.org/packages\\|elpa.gnu.org/devel\\|elpa.nongnu.org/nongnu\\)\\(?:/.*\\).html") - (:command emms-play-url - :schemes - ("ftp" "http" "https" "mms" "rtmp" "rtsp" "sftp" "smb" "srt") - ) ;;FIXME: buggy - ;; TODO: magit-clone-shallow, osm - ) - - :file - ;; by mimetypes / extensions etc, most can be handled by find-file? - ;; shell can be used for dir - ((:command find-file) - (:command dired :mimetypes ("inode/directory")) - (:command my-shell-with-directory :mimetypes ("inode/directory")) - (:command magit-status :mimetypes ("inode/directory")) - (:command byte-compile-file :mimetypes ("text/x-lisp")) - (:command hmm-file-mime-type)))) + (my-setq-from-local hmm-handlers) (setq hmm-external-handlers '((:name mpv :external-command "mpv %U" diff --git a/emacs/.emacs.d/init/ycp-dired.el b/emacs/.emacs.d/init/ycp-dired.el index e8a10ae..613bc0b 100644 --- a/emacs/.emacs.d/init/ycp-dired.el +++ b/emacs/.emacs.d/init/ycp-dired.el @@ -112,6 +112,7 @@ ;;; dired-du (my-package dired-du + (:install t) (require 'dired-du) (setq dired-du-size-format 'comma)) diff --git a/emacs/.emacs.d/init/ycp-fun.el b/emacs/.emacs.d/init/ycp-fun.el index 41dd482..1f75a51 100644 --- a/emacs/.emacs.d/init/ycp-fun.el +++ b/emacs/.emacs.d/init/ycp-fun.el @@ -29,7 +29,7 @@ (my-package meme (:delay 60)) -(my-package slime-volleyball (:delay 60)) +(my-package slime-volleyball (:install t) (:delay 60)) (provide 'ycp-fun) ;;; ycp-fun.el ends here diff --git a/emacs/.emacs.d/init/ycp-gnus.el b/emacs/.emacs.d/init/ycp-gnus.el index 7a03703..407d89b 100644 --- a/emacs/.emacs.d/init/ycp-gnus.el +++ b/emacs/.emacs.d/init/ycp-gnus.el @@ -75,14 +75,7 @@ (setq gnus-select-method '(nnnil "")) (setq gnus-group-line-format "%M%S%p%P%5y:%B%(%G%) ") - (setq gnus-secondary-select-methods - '( - ;; "fastdove" is just a name given to gnus - (nnimap "fastdove" - (nnimap-address "localhost") - (nnimap-stream plain) - (nnimap-server-port "imap")) - )) + (my-setq-from-local gnus-secondary-select-methods) (setq gnus-agent t) (dolist (mode '(gnus-group-mode-hook gnus-summary-mode-hook diff --git a/emacs/.emacs.d/init/ycp-markup.el b/emacs/.emacs.d/init/ycp-markup.el index c001131..65a9db0 100644 --- a/emacs/.emacs.d/init/ycp-markup.el +++ b/emacs/.emacs.d/init/ycp-markup.el @@ -93,5 +93,13 @@ (my-override nov-scroll-up) ) +;;; json-mode +(my-package json-mode + (:delay 30) + (:install t) + (require 'my-prog) + (add-hook 'json-mode-hook 'my-json-set-header-line-to-path) + ) + (provide 'ycp-markup) ;;; ycp-markup.el ends here diff --git a/emacs/.emacs.d/init/ycp-org.el b/emacs/.emacs.d/init/ycp-org.el index 240cfcf..20817ac 100644 --- a/emacs/.emacs.d/init/ycp-org.el +++ b/emacs/.emacs.d/init/ycp-org.el @@ -17,8 +17,12 @@ "M-n" #'org-next-link "M-p" #'org-previous-link "C-c C-l" #'org-insert-link - "C-j" #'default-indent-new-line ) + (if (string< (org-version) "9.6") + (my-keybind org-mode-map + "C-j" #'org-return-and-maybe-indent) + (my-keybind org-mode-map + "C-j" #'default-indent-new-line)) (my-keybind minibuffer-mode-map "M-l" #'org-insert-last-stored-link) (my-setq-from-local my-org-common-properties org-directory my-org-doc-dir) @@ -413,5 +417,9 @@ (define-key eww-mode-map (kbd "C-'") 'my-eww-org-protocol-grok) ) +(my-package ox-jira + (:delay 60) + (require 'my-ox-jira)) + (provide 'ycp-org) ;;; ycp-org.el ends here diff --git a/emacs/.emacs.d/init/ycp-prog.el b/emacs/.emacs.d/init/ycp-prog.el index 2fdb63e..f5adcfa 100644 --- a/emacs/.emacs.d/init/ycp-prog.el +++ b/emacs/.emacs.d/init/ycp-prog.el @@ -70,14 +70,49 @@ (:delay 5) (setq sh-basic-offset 2) (add-to-list 'auto-mode-alist '("PKGBUILD" . sh-mode)) -) + ) + +(my-package gud + (:delay 10) + (require 'gdb-mi) + (setq gdb-many-windows t) + (setq gdb-default-window-configuration-file + (locate-user-emacs-file "gdb-window-conf")) + (require 'my-prog) + (my-keybind global-map + "C-c d q" 'my-gdb-quit + "C-c d d" 'my-gdb + "C-c d r" 'my-gdb-restart) + (my-keybind gdb-frames-mode-map + "b" 'my-gdb-frames-add-breakpoint + "d" 'my-gdb-frames-remove-breakpoint + "o" 'gdb-select-frame + "s" 'my-gdb-switch-to-source-buffer + "n" 'my-gdb-frames-select-next + "p" 'my-gdb-frames-select-previous) + (my-keybind gdb-breakpoints-mode-map + "n" 'forward-line + "p" (lambda () (interactive) (forward-line -1)) + "d" 'gdb-delete-breakpoint) + (my-keybind gdb-threads-mode-map + "n" 'forward-line + "p" (lambda () (interactive) (forward-line -1))) + (my-keybind gud-mode-map + "C-c C-p" 'comint-previous-prompt + "C-c C-n" 'comint-next-prompt + "C-c C-u" 'gud-up + "C-c C-d" 'gud-down + "C-c C-n" 'comint-next-prompt) + (add-hook 'gud-mode-hook 'my-gud-comint-set-prompt-regexp) + (add-hook 'gud-mode-hook 'company-mode) + ) (my-package my-prog (:delay 10) ;; tab-width 8 for ls etc. (add-hook 'shell-mode-hook 'my-set-tab-width-to-8) (my-keybind comint-mode-map "C-" - #'my-comint-send-input-and-return-prompt) + #'my-comint-send-input-and-return-prompt) (add-to-list 'my-buffer-create-functions '(shell-mode . my-shell-with-directory)) (my-keybind shell-mode-map "" #'my-restart-shell) @@ -94,8 +129,10 @@ (my-package bash-completion (:install t) (:delay 15) - (bash-completion-setup) -) + ;; FIXME: it is behaving weirdly in shell mode, with completion + ;; flushed to the buffer + ;; (bash-completion-setup) + ) ;;; prog modes: c, c++, elisp, js, css, ts, (my-package prog-mode @@ -112,10 +149,8 @@ (add-to-list 'eglot-server-programs '((php-mode phps-mode) "phpactor" "language-server" "-vvv")) - (add-hook 'before-save-hook (lambda () (interactive) - (when (eglot-managed-p) - (unless (eq major-mode 'haskell-mode) - (eglot-format-buffer))))) + (add-hook 'before-save-hook + #'my-eglot-format-buffer-when-managed) (setq-default eglot-workspace-configuration '((:pylsp (plugins @@ -146,12 +181,18 @@ (my-package cc-mode (:delay 5) (define-key c-mode-map (kbd "C-c C-c") 'compile) + (define-key c++-mode-map (kbd "C-c C-c") 'project-compile) + (add-to-list 'auto-mode-alist '("\\.inl\\'" . c++-mode)) ) (my-package my-prog (:delay 10) - (add-hook 'c-mode-hook 'my-c-set-compile-command) (my-keybind global-map "C-c 8" #'my-set-tab-width-to-8) + (add-hook 'c-mode-hook 'my-c-set-compile-command) + (define-key c-mode-map (kbd "C-c s") 'my-c-switch-between-header-and-source) + (define-key c++-mode-map (kbd "C-c s") + 'my-c-switch-between-header-and-source) + (my-override bookmark-make-record) ) ;;; emacs-lisp mode @@ -206,6 +247,7 @@ "M-p" #'flymake-goto-prev-error)) (my-package my-prog + (:delay 10) (require 'xref) (my-override xref-query-replace-in-results)) @@ -338,7 +380,7 @@ (my-package imenu (:delay 5) (my-keybind global-map "C-c i" #'imenu) -) + ) ;;; proof-general (my-package proof-general @@ -372,5 +414,50 @@ (:delay 60) (setq sml-indent-level 2)) +;;; mariadb development +(my-package my-mariadb + (:delay 15) + (setq sql-product 'mariadb) + (add-to-list 'auto-mode-alist + '("\\.test\\'" . (lambda () + (sql-mode) + (setq comment-start "#")))) + (add-to-list 'auto-mode-alist + '("\\.inc\\'" . (lambda () + (sql-mode) + (setq comment-start "#")))) + (add-to-list 'auto-mode-alist '("\\.cnf\\'" . conf-mode)) + (define-key sql-mode-map (kbd "C-c C-c") 'my-sql-maybe-mtrr) + (my-keybind global-map + "C-c d m" 'my-gdb-maria + "C-c d s" 'my-gdb-maria-spider + ) + (define-key gud-mode-map (kbd "C-c C-z") 'my-gdb-mysql-parse-frame) + ) + +;;; bison +(my-package bison-mode + (:delay 30) + (:install t) + (add-to-list 'auto-mode-alist '("\\.yy\\'" . bison-mode)) + (define-key bison-mode-map (kbd "C-c C-c") 'project-compile) + (require 'my-prog) + (add-hook 'bison-mode-hook + 'my-bison-set-imenu-create-index-function) + ) + +;;; which-func +(my-package which-func + (:delay 5) + (setq which-func-modes + '(org-mode c-mode c++-mode bison-mode shell-script-mode emacs-lisp-mode + sql-mode json-mode)) + (which-function-mode) + (add-hook 'org-mode-hook 'my-set-header-line-to-which-func) + (add-hook 'c-mode-hook 'my-set-header-line-to-which-func) + (add-hook 'emacs-lisp-mode-hook 'my-set-header-line-to-which-func) + (add-hook 'c++-mode-hook 'my-set-header-line-to-which-func) + ) + (provide 'ycp-prog) ;;; ycp-prog.el ends here diff --git a/emacs/.emacs.d/init/ycp-project.el b/emacs/.emacs.d/init/ycp-project.el index 7c208ed..f6ea925 100644 --- a/emacs/.emacs.d/init/ycp-project.el +++ b/emacs/.emacs.d/init/ycp-project.el @@ -40,6 +40,8 @@ my-project-remember-projects-timer 300 t 'my-project-remember-all-projects) + (delete '(project-eshell "Eshell") project-switch-commands) + (add-to-list 'project-switch-commands '(project-shell "Shell")) ) (provide 'ycp-project) diff --git a/emacs/.emacs.d/init/ycp-vc.el b/emacs/.emacs.d/init/ycp-vc.el index 49ef58e..d9de2ca 100644 --- a/emacs/.emacs.d/init/ycp-vc.el +++ b/emacs/.emacs.d/init/ycp-vc.el @@ -58,7 +58,8 @@ (my-package vc-git (:delay 30) (add-to-list 'safe-local-variable-values - '(vc-git-annotate-switches . "-w"))) + '(vc-git-annotate-switches . "-w")) + (setq vc-git-grep-template "git --no-pager grep -n -A1 -B1 -e -- ")) (my-package git-commit (:install t) @@ -72,6 +73,7 @@ (require 'magit-diff) (setq magit-diff-refine-hunk t) + (setq magit-diff-adjust-tab-width t) (require 'magit-repos) (my-setq-from-local magit-repository-directories) @@ -81,7 +83,9 @@ (my-package my-magit (:delay 30) (my-keybind global-map - "\C-xpM" #'my-project-magit-at)) + "C-x pM" #'my-project-magit-at + "C-x g" #'my-magit-status) +) (my-package magit-annex (:delay 60)) diff --git a/emacs/.emacs.d/init/ycp-web.el b/emacs/.emacs.d/init/ycp-web.el index af13d5c..19c4095 100644 --- a/emacs/.emacs.d/init/ycp-web.el +++ b/emacs/.emacs.d/init/ycp-web.el @@ -71,7 +71,20 @@ (my-package buildbot (:delay 30) (my-setq-from-local buildbot-host buildbot-github-status-builders) - (setq buildbot-builders (ignore-error (buildbot-get-all-builders))) + (setq buildbot-builders (ignore-errors (buildbot-get-all-builders))) +) + +(my-package org-jira + (:delay 30) + (my-setq-from-local jiralib-url + org-jira-priority-to-org-priority-alist + org-jira-jira-status-to-org-keyword-alist + org-jira-project-filename-alist + org-jira-custom-jqls) + (require 'my-org-jira) + (my-override org-jira--render-issue) + (my-override org-jira-update-worklogs-from-org-clocks) + (my-keybind org-jira-entry-mode-map "C-c ig" 'org-jira-get-issue) ) (my-package eww -- cgit v1.2.3