aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules6
-rw-r--r--emacs/.emacs.d/gdb-window-conf1
-rw-r--r--emacs/.emacs.d/init/ycp-buffer.el4
-rw-r--r--emacs/.emacs.d/init/ycp-client.el4
-rw-r--r--emacs/.emacs.d/init/ycp-complete.el75
-rw-r--r--emacs/.emacs.d/init/ycp-dired.el1
-rw-r--r--emacs/.emacs.d/init/ycp-fun.el2
-rw-r--r--emacs/.emacs.d/init/ycp-gnus.el9
-rw-r--r--emacs/.emacs.d/init/ycp-markup.el8
-rw-r--r--emacs/.emacs.d/init/ycp-org.el10
-rw-r--r--emacs/.emacs.d/init/ycp-prog.el107
-rw-r--r--emacs/.emacs.d/init/ycp-project.el2
-rw-r--r--emacs/.emacs.d/init/ycp-vc.el8
-rw-r--r--emacs/.emacs.d/init/ycp-web.el15
-rw-r--r--emacs/.emacs.d/lisp/my/my-magit.el11
-rw-r--r--emacs/.emacs.d/lisp/my/my-mariadb.el126
-rw-r--r--emacs/.emacs.d/lisp/my/my-org-jira.el184
-rw-r--r--emacs/.emacs.d/lisp/my/my-ox-jira.el45
-rw-r--r--emacs/.emacs.d/lisp/my/my-prog.el279
m---------emacs/.emacs.d/lisp/org-jira0
m---------emacs/.emacs.d/lisp/ox-jira.el0
-rw-r--r--mariadb-server/storage/spider/.dir-locals.el12
-rw-r--r--misc/.bashrc16
-rw-r--r--misc/bin/gdb-mi.sh2
24 files changed, 835 insertions, 92 deletions
diff --git a/.gitmodules b/.gitmodules
index e4e859a..733000b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -76,3 +76,9 @@
[submodule ".emacs.d/lisp/mastodon.el"]
path = emacs/.emacs.d/lisp/mastodon.el
url = https://codeberg.org/martianh/mastodon.el
+[submodule "emacs/.emacs.d/lisp/org-jira"]
+ path = emacs/.emacs.d/lisp/org-jira
+ url = https://github.com/ahungry/org-jira
+[submodule "emacs/.emacs.d/lisp/ox-jira.el"]
+ path = emacs/.emacs.d/lisp/ox-jira.el
+ url = https://github.com/stig/ox-jira.el
diff --git a/emacs/.emacs.d/gdb-window-conf b/emacs/.emacs.d/gdb-window-conf
new file mode 100644
index 0000000..0d4126c
--- /dev/null
+++ b/emacs/.emacs.d/gdb-window-conf
@@ -0,0 +1 @@
+(((min-height . 16) (min-width . 20) (min-height-ignore . 8) (min-width-ignore . 12) (min-height-safe . 4) (min-width-safe . 4) (min-pixel-height . 336) (min-pixel-width . 200) (min-pixel-height-ignore . 168) (min-pixel-width-ignore . 120) (min-pixel-height-safe . 84) (min-pixel-width-safe . 40)) hc (pixel-width . 2556) (pixel-height . 1380) (total-width . 256) (total-height . 66) (normal-height . 1.0) (normal-width . 1.0) (combination-limit) (vc (pixel-width . 850) (pixel-height . 1380) (total-width . 85) (total-height . 66) (normal-height . 1.0) (normal-width . 0.33255086071987483) (combination-limit) (leaf (pixel-width . 850) (pixel-height . 336) (total-width . 85) (total-height . 16) (normal-height . 0.24347826086956526) (normal-width . 1.0) (parameters (gdb-buffer-type . command)) (buffer " *gdb-placeholder*" (selected) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 2 t nil 0 t nil) (vscroll . 0) (dedicated) (point . 1) (start . 1))) (leaf (pixel-width . 850) (pixel-height . 336) (total-width . 85) (total-height . 16) (normal-height . 0.24347826086956514) (normal-width . 1.0) (parameters (gdb-buffer-type . gdb-stack-buffer)) (buffer " *gdb-placeholder*" (selected) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 2 t nil 0 t nil) (vscroll . 0) (dedicated . t) (point . 1) (start . 1))) (leaf (pixel-width . 850) (pixel-height . 357) (total-width . 85) (total-height . 17) (normal-height . 0.2586956521739131) (normal-width . 1.0) (parameters (gdb-buffer-type . gdb-locals-buffer)) (buffer " *gdb-placeholder*" (selected) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 2 t nil 0 t nil) (vscroll . 0) (dedicated . t) (point . 1) (start . 1))) (leaf (last . t) (pixel-width . 850) (pixel-height . 351) (total-width . 85) (total-height . 17) (normal-height . 0.2543478260869565) (normal-width . 1.0) (parameters (gdb-buffer-type . gdb-breakpoints-buffer)) (buffer " *gdb-placeholder*" (selected . t) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 2 t nil 0 t nil) (vscroll . 0) (dedicated . t) (point . 1) (start . 1)))) (leaf (last . t) (pixel-width . 1706) (pixel-height . 1380) (total-width . 171) (total-height . 66) (normal-height . 1.0) (normal-width . 0.6674491392801252) (parameters (gdb-buffer-type . source)) (buffer " *gdb-placeholder*" (selected) (hscroll . 0) (fringes 8 8 nil nil) (margins nil) (scroll-bars nil 2 t nil 0 t nil) (vscroll . 0) (dedicated) (point . 1) (start . 1)))) \ No newline at end of file
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
+ "<ret>" 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-<return>"
- #'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 "<f2>" #'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 <C> -A1 -B1 -e <R> -- <F>"))
(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
diff --git a/emacs/.emacs.d/lisp/my/my-magit.el b/emacs/.emacs.d/lisp/my/my-magit.el
index 779c7c7..cf6749b 100644
--- a/emacs/.emacs.d/lisp/my/my-magit.el
+++ b/emacs/.emacs.d/lisp/my/my-magit.el
@@ -55,5 +55,16 @@
(interactive)
(magit-status (my-project-read-project-root)))
+;; override `magit-status' to allow build dir and src dir distinction
+;; FIXME: there ought to be a better solution to do project things
+;; from the builddir
+(defun my-magit-status ()
+ (interactive)
+ (if (magit-toplevel)
+ (magit-status)
+ (magit-status
+ (replace-regexp-in-string "/build\\>.*" "/src"
+ default-directory))))
+
(provide 'my-magit)
;;; my-magit.el ends here
diff --git a/emacs/.emacs.d/lisp/my/my-mariadb.el b/emacs/.emacs.d/lisp/my/my-mariadb.el
new file mode 100644
index 0000000..5ffd6a0
--- /dev/null
+++ b/emacs/.emacs.d/lisp/my/my-mariadb.el
@@ -0,0 +1,126 @@
+;;; my-mariadb.el -- Customization for mariadb development-branch -*- lexical-binding: t -*-
+
+;; Copyright (C) 2023 Free Software Foundation.
+
+;; Author: Yuchen Pei <id@ypei.org>
+;; Package-Requires: ((emacs "28.2"))
+
+;; This file is part of dotted.
+
+;; dotted is free software: you can redistribute it and/or modify it under
+;; the terms of the GNU Affero General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; dotted is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
+;; Public License for more details.
+
+;; You should have received a copy of the GNU Affero General Public
+;; License along with dotted. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Customization for mariadb development-branch.
+
+;;; Code:
+
+(require 'my-prog)
+
+(defun my-sql-maybe-mtrr ()
+ (interactive)
+ (if (equal (file-name-extension (buffer-file-name))
+ "test")
+ (call-interactively 'project-compile)
+ (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))
+ (my-gdb-quit))
+ (sleep-for 1)
+ (my-gdb
+ (format "rr replay %s -d ~/bin/gdb-mi.sh"
+ (expand-file-name
+ (replace-regexp-in-string
+ "/src"
+ "/build/mysql-test/var/log/mysqld.1.rr/latest-trace"
+ (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))
+ (my-gdb-quit))
+ (sleep-for 1)
+ (my-gdb
+ (format "rr replay %s -d /home/ycp/source/mariadb-tools/gdb-mi.sh"
+ (expand-file-name
+ (replace-regexp-in-string
+ "/src"
+ "/build/mysql-test/var/log/mysqld.1.1.rr/latest-trace"
+ (project-root (project-current t)))))))
+
+(defun my-maria-style ()
+ (setq comment-start "/* "
+ comment-end " */"
+ comment-continue " "
+ comment-style 'extra-line))
+
+(setq my-c-style-maria-spider
+ '("maria-spider"
+ (c-basic-offset . 2)
+ (c-offsets-alist
+ . (;; no indentation when opening an brace
+ (substatement-open . 0)
+ ;; no extra space when aligning continued lines of block comments
+ (c . 0)
+ (arglist-intro . +)
+ (arglist-close . 0)
+ (arglist-cont-nonempty c-lineup-gcc-asm-reg c-lineup-arglist)
+ (arglist-cont . 0)
+ (statement-block-intro . +)
+ ))
+ ;; empty comment start on block comment continuation refill
+ (c-block-comment-prefix . "")
+))
+
+(add-to-list 'c-style-alist my-c-style-maria-spider)
+
+(defun my-mdev-22979 (beg end)
+ (interactive "r")
+ (save-excursion
+ (goto-char end)
+ (insert " )},
+")
+ (goto-char beg)
+ (insert " {C_STRING_WITH_LEN(
+")))
+
+(defun my-gdb-mysql-parse-frame ()
+ (interactive)
+ (let ((old-frame) (level))
+ (with-current-buffer (gdb-stack-buffer-name)
+ (save-excursion
+ (beginning-of-buffer)
+ (setq old-frame (point))
+ (text-property-search-forward
+ 'gdb-frame
+ "mysql_parse"
+ (lambda (val prop) (equal (alist-get 'func prop) val)))
+ (beginning-of-line)
+ (setq level (alist-get 'level (get-text-property (point) 'gdb-frame)))))
+ (with-current-buffer gud-comint-buffer
+ (insert "f " level)
+ (comint-send-input))
+ (with-current-buffer (gdb-stack-buffer-name)
+ (save-excursion
+ (goto-char old-frame)
+ (gdb-select-frame)))))
+
+(provide 'my-mariadb)
+;;; my-mariadb.el ends here
diff --git a/emacs/.emacs.d/lisp/my/my-org-jira.el b/emacs/.emacs.d/lisp/my/my-org-jira.el
new file mode 100644
index 0000000..7ff7738
--- /dev/null
+++ b/emacs/.emacs.d/lisp/my/my-org-jira.el
@@ -0,0 +1,184 @@
+;;; my-org-jira.el -- Extensions for org-jira -*- lexical-binding: t -*-
+
+;; Copyright (C) 2023 Free Software Foundation.
+
+;; Author: Yuchen Pei <id@ypei.org>
+;; Package-Requires: ((emacs "28.2"))
+
+;; This file is part of dotted.
+
+;; dotted is free software: you can redistribute it and/or modify it under
+;; the terms of the GNU Affero General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; dotted is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
+;; Public License for more details.
+
+;; You should have received a copy of the GNU Affero General Public
+;; License along with dotted. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Extensions for org-jira.
+
+;;; Code:
+
+(require 'org-jira)
+
+;; Override `org-jira--render-issue'
+;; include issue-id in the headline
+(defun my-org-jira--render-issue (Issue)
+ "Render single ISSUE."
+ ;; (org-jira-log "Rendering issue from issue list")
+ ;; (org-jira-log (org-jira-sdk-dump Issue))
+ (with-slots (filename proj-key issue-id summary status priority headline id) Issue
+ (let (p)
+ (with-current-buffer (org-jira--get-project-buffer Issue)
+ (org-jira-freeze-ui
+ (org-jira-maybe-activate-mode)
+ (org-jira--maybe-render-top-heading proj-key)
+ (setq p (org-find-entry-with-id issue-id))
+ (save-restriction
+ (if (and p (>= p (point-min))
+ (<= p (point-max)))
+ (progn
+ (goto-char p)
+ (forward-thing 'whitespace)
+ (org-jira-kill-line))
+ (goto-char (point-max))
+ (unless (looking-at "^")
+ (insert "\n"))
+ (insert "** "))
+ (org-jira-insert
+ (concat (org-jira-get-org-keyword-from-status status)
+ " "
+ (org-jira-get-org-priority-cookie-from-issue priority)
+ issue-id " " headline))
+ (save-excursion
+ (unless (search-forward "\n" (point-max) 1)
+ (insert "\n")))
+ (org-narrow-to-subtree)
+ (save-excursion
+ (org-back-to-heading t)
+ (org-set-tags-to (replace-regexp-in-string "-" "_" issue-id)))
+ (mapc (lambda (entry)
+ (let ((val (slot-value Issue entry)))
+ (when (or (and val (not (string= val "")))
+ (eq entry 'assignee)) ;; Always show assignee
+ (org-jira-entry-put (point) (symbol-name entry) val))))
+ '(assignee filename reporter type type-id priority labels resolution status components created updated sprint))
+
+ (org-jira-entry-put (point) "ID" issue-id)
+ (org-jira-entry-put (point) "CUSTOM_ID" issue-id)
+
+ ;; Insert the duedate as a deadline if it exists
+ (when org-jira-deadline-duedate-sync-p
+ (let ((duedate (oref Issue duedate)))
+ (when (> (length duedate) 0)
+ (org-deadline nil duedate))))
+
+ (mapc
+ (lambda (heading-entry)
+ (ensure-on-issue-id-with-filename issue-id filename
+ (let* ((entry-heading
+ (concat (symbol-name heading-entry)
+ (format ": [[%s][%s]]"
+ (concat jiralib-url "/browse/" issue-id) issue-id))))
+ (setq p (org-find-exact-headline-in-buffer entry-heading))
+ (if (and p (>= p (point-min))
+ (<= p (point-max)))
+ (progn
+ (goto-char p)
+ (org-narrow-to-subtree)
+ (goto-char (point-min))
+ (forward-line 1)
+ (delete-region (point) (point-max)))
+ (if (org-goto-first-child)
+ (org-insert-heading)
+ (goto-char (point-max))
+ (org-insert-subheading t))
+ (org-jira-insert entry-heading "\n"))
+
+ ;; Insert 2 spaces of indentation so Jira markup won't cause org-markup
+ (org-jira-insert
+ (replace-regexp-in-string
+ "^" " "
+ (format "%s" (slot-value Issue heading-entry)))))))
+ '(description))
+
+ (when org-jira-download-comments
+ (org-jira-update-comments-for-issue Issue)
+
+ ;; FIXME: Re-enable when attachments are not erroring.
+ ;;(org-jira-update-attachments-for-current-issue)
+ )
+
+ ;; only sync worklog clocks when the user sets it to be so.
+ (when org-jira-worklog-sync-p
+ (org-jira-update-worklogs-for-issue issue-id filename))))))))
+
+;; Overload `org-jira-update-worklogs-from-org-clocks'.
+(defun my-org-jira-update-worklogs-from-org-clocks ()
+ "Update or add a worklog based on the org clocks."
+ (interactive)
+ (let* ((issue-id (org-jira-get-from-org 'issue 'key))
+ (filename (org-jira-filename))
+ ;; Fetch all workflogs for this issue
+ (jira-worklogs-ht (org-jira-worklog-to-hashtable issue-id)))
+ (org-jira-log (format "About to sync worklog for issue: %s in file: %s"
+ issue-id filename))
+ (ensure-on-issue-id-with-filename
+ issue-id filename
+ (search-forward (format ":%s:" (or (org-clock-drawer-name) "LOGBOOK")) nil 1 1)
+ (org-beginning-of-line)
+ ;; (org-cycle 1)
+ (while (search-forward "CLOCK: " nil 1 1)
+ (let ((org-time (buffer-substring-no-properties (point) (point-at-eol))))
+ (forward-line)
+ ;; See where the stuff ends (what point)
+ (let (next-clock-point)
+ (save-excursion
+ (search-forward-regexp "\\(CLOCK\\|:END\\):" nil 1 1)
+ (setq next-clock-point (point)))
+ (let ((clock-content
+ (buffer-substring-no-properties (point) next-clock-point)))
+ ;; Update via jiralib call
+ (let* ((worklog (org-jira-org-clock-to-jira-worklog org-time clock-content))
+ (comment-text (cdr (assoc 'comment worklog)))
+ (comment-text (if (string= (org-trim comment-text) "") nil comment-text)))
+ (unless (cdr (assoc 'worklog-id worklog))
+ (jiralib-add-worklog
+ issue-id
+ (cdr (assoc 'started worklog))
+ (cdr (assoc 'time-spent-seconds worklog))
+ comment-text
+ nil) ; no callback - synchronous
+ )
+ )))))
+ (org-jira-log (format "Updating worklog from org-jira-update-worklogs-from-org-clocks call"))
+ (org-jira-update-worklogs-for-issue issue-id filename)
+ )))
+
+(defun my-org-jira-comment-url (issue-id comment-id)
+ (format
+ "%s/browse/%s?focusedCommentId=%s&page=com.atlassian.jira.plugin.system.issuetabpanels%%3Acomment-tabpanel#comment-%s"
+ jiralib-url issue-id comment-id comment-id))
+
+(defun my-org-jira-comment-url-at-point ()
+ (my-org-jira-comment-url
+ (org-entry-get
+ (save-excursion
+ (outline-up-heading 1)
+ (point))
+ "ID")
+ (org-entry-get (point) "ID")))
+
+(defun my-org-jira-kill-comment-url-at-point ()
+ (interactive)
+ (kill-new (my-org-jira-comment-url-at-point)))
+
+(provide 'my-org-jira)
+;;; my-org-jira.el ends here
diff --git a/emacs/.emacs.d/lisp/my/my-ox-jira.el b/emacs/.emacs.d/lisp/my/my-ox-jira.el
new file mode 100644
index 0000000..ac581bf
--- /dev/null
+++ b/emacs/.emacs.d/lisp/my/my-ox-jira.el
@@ -0,0 +1,45 @@
+;;; my-ox-jira.el -- Extensions to ox-jira -*- lexical-binding: t -*-
+
+;; Copyright (C) 2023 Free Software Foundation.
+
+;; Author: Yuchen Pei <id@ypei.org>
+;; Package-Requires: ((emacs "28.2"))
+
+;; This file is part of dotted.
+
+;; dotted is free software: you can redistribute it and/or modify it under
+;; the terms of the GNU Affero General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; dotted is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
+;; Public License for more details.
+
+;; You should have received a copy of the GNU Affero General Public
+;; License along with dotted. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Extensions to ox-jira.
+
+;;; Code:
+
+(require 'ox-jira)
+(require 'my-prog)
+(defun my-org-backtrace-to-github-jira (beg end)
+ (interactive "r")
+ (let ((bt (buffer-substring-no-properties beg end))
+ (revision (when current-prefix-arg
+ (read-string "Rrevision: ")))
+ )
+ (with-temp-buffer
+ (insert "#+options: ^:nil
+")
+ (goto-char (point-max))
+ (insert (my-org-backtrace-to-github bt revision))
+ (ox-jira-export-as-jira))))
+
+(provide 'my-ox-jira)
+;;; my-ox-jira.el ends here
diff --git a/emacs/.emacs.d/lisp/my/my-prog.el b/emacs/.emacs.d/lisp/my/my-prog.el
index 210d7ef..309df2e 100644
--- a/emacs/.emacs.d/lisp/my/my-prog.el
+++ b/emacs/.emacs.d/lisp/my/my-prog.el
@@ -86,6 +86,26 @@
"-ansi -pedantic -Wall -g")
file)))))
+(defun my-c-switch-between-header-and-source ()
+ "Switch between a c/c++ header (.h) and its corresponding source (.c/.cpp/.cc)."
+ (interactive)
+ (let ((bse (file-name-sans-extension buffer-file-name))
+ (ext (downcase (file-name-extension buffer-file-name)))
+ (new-file))
+ (cond
+ ;; first condition - the extension is "h"
+ ((equal ext "h")
+ (cond ((file-exists-p (setq new-file (concat bse ".c")))
+ (find-file new-file))
+ ((file-exists-p (setq new-file (concat bse ".cpp")))
+ (find-file new-file))
+ ((file-exists-p (setq new-file (concat bse ".cc")))
+ (find-file new-file))))
+ ;; second condition - the extension is "c" or "cpp"
+ ((member ext '("c" "cpp" "cc"))
+ (when (file-exists-p (setq new-file (concat bse ".h")))
+ (find-file new-file))))))
+
;;; To override `xref-query-replace-in-results'.
(defun my-xref-query-replace-in-results (from to)
"Perform interactive replacement of FROM with TO in all displayed xrefs.
@@ -155,5 +175,264 @@ create a shell buffer using `my-shell-with-directory'"
(call-interactively 'my-shell-with-directory)
(my-buffer-quick-major-mode 'shell-mode)))
+;;; gdb
+(require 'gdb-mi)
+(require 'gud)
+(require 'org)
+(defun my-org-backtrace-region (beg end)
+ "Convert selected backtrace to org links and copy the result to kill ring.
+
+With a prefix arg, convert from bottom to top."
+ (let ((bt (buffer-substring-no-properties beg end))
+ (case-fold-search nil)
+ (results) (func-name))
+ (with-temp-buffer
+ (insert bt)
+ (goto-char (point-min))
+ ;; remove paging lines
+ (flush-lines "^--.*--$")
+ (goto-char (point-min))
+ (while (re-search-forward "^#[0-9]+\\ +\\(?:[0-9a-fx]+ in \\)?\\([^ ]+\\) .*$" end t)
+ (setq func-name (match-string-no-properties 1))
+ (let ((point-from) (file-location-from)
+ (point-at) (file-location-at)
+ (file-location))
+ (save-excursion
+ (when (re-search-forward " from \\(/[^ ]+\\)$" end t)
+ (setq file-location-from (match-string-no-properties 1)
+ point-from (point))))
+ (save-excursion
+ ;; a weak check of file:lineno
+ (when (re-search-forward " at \\(/[^ ]+:.*\\)$" end t)
+ (setq file-location-at (match-string-no-properties 1)
+ point-at (point))))
+ (setq file-location
+ (cond ((not file-location-from) file-location-at)
+ ((not file-location-at) file-location-from)
+ ((< point-at point-from) file-location-at)
+ (t file-location-from)))
+ (when (and func-name file-location)
+ (push (concat "[[" file-location "][" func-name "]]") results))))
+ (unless current-prefix-arg (setq results (reverse results)))
+ (kill-new (string-join results (if current-prefix-arg " < " " > "))))))
+
+(defun my-stack-frame-to-org (rev)
+ "Convert stack frame in gdb frames buffer to org.
+
+Conversion is in a similar fashion to `my-org-backtrace-region'."
+ (let ((results))
+ (with-current-buffer (gdb-stack-buffer-name)
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward "^[0-9]+\\ +in \\(.*\\) of \\(.*\\)$" nil t)
+ (setq func-name (match-string-no-properties 1)
+ file-location (match-string-no-properties 2))
+ (push (concat "[[" file-location "][" func-name "]]") results))))
+ (unless rev (setq results (reverse results)))
+ (string-join results (if current-prefix-arg " < " " > "))))
+
+(defun my-insert-stack-frame-to-org (rev)
+ (interactive "P")
+ (insert (my-stack-frame-to-org rev)))
+
+(defun my-kill-stack-frame-to-org (rev)
+ (interactive "P")
+ (kill-new (my-stack-frame-to-org rev)))
+
+(defun my-org-backtrace ()
+ (interactive)
+ (if (region-active-p)
+ (my-org-backtrace-region (region-beginning) (region-end))
+ (my-org-backtrace-region
+ (point)
+ (save-excursion (comint-next-prompt 1) (point)))))
+
+(defun my-gdb (&optional command)
+ "lock gud command buffer and restore middle and right windows.
+
+Assuming a three window horizontal split to start with. Assuming
+the default configuration of gdb windows is all of them on the
+left and the source buffer on the right.
+"
+ (interactive)
+ ;; save windows
+ (let* ((old-window (selected-window))
+ (right-buffer
+ (window-buffer
+ (progn
+ (while (window-in-direction 'right)
+ (select-window (window-in-direction 'right)))
+ (selected-window))))
+ (middle-buffer
+ (window-buffer
+ (window-in-direction 'left))))
+ (select-window old-window)
+ ;; call gdb
+ (if (called-interactively-p)
+ (call-interactively 'gdb)
+ (gdb command))
+ (sleep-for 6)
+ ;; lock gud-comint-buffer
+ (my-toggle-lock-window-to-buffer (get-buffer-window gud-comint-buffer))
+ ;; restore windows
+ (select-window (car gdb-source-window-list))
+ (switch-to-buffer middle-buffer)
+ (split-window-horizontally)
+ (select-window (window-next-sibling))
+ (switch-to-buffer right-buffer)
+ (balance-windows)
+ (when (window-live-p old-window) (select-window old-window))))
+
+(defun my-gdb-restart ()
+ (interactive)
+ (let ((old-window (selected-window)))
+ (select-window (get-buffer-window gud-comint-buffer))
+ (gdb-delchar-or-quit 0)
+ (call-interactively 'my-gdb)
+ (when (window-live-p old-window) (select-window old-window))))
+
+(defun my-gdb-kill ()
+ (interactive)
+ (let ((kill-buffer-query-functions nil))
+ (kill-buffer "*gud-replay*")))
+
+(defun my-gdb-quit ()
+ (interactive)
+ (let ((old-window (selected-window)))
+ (select-window (get-buffer-window gud-comint-buffer))
+ (goto-char (point-max))
+ (gdb-delchar-or-quit 0)
+ (my-toggle-lock-current-window-to-buffer)
+ (when (window-live-p old-window) (select-window old-window))))
+
+(defun my-gdb-frames-add-breakpoint ()
+ (interactive)
+ (gdb-select-frame)
+ (with-current-buffer (gdb-get-source-buffer)
+ (call-interactively 'gud-break)))
+
+(defun my-gdb-frames-remove-breakpoint ()
+ (interactive)
+ (gdb-select-frame)
+ (with-current-buffer (gdb-get-source-buffer)
+ (call-interactively 'gud-remove)))
+
+(defun my-gdb-frames-select-next (n)
+ (interactive "p")
+ (next-line n)
+ (gdb-select-frame))
+(defun my-gdb-frames-select-previous (n)
+ (interactive "p")
+ (next-line (- n))
+ (gdb-select-frame))
+(defun my-gdb-switch-to-source-buffer ()
+ (interactive)
+ (select-window (display-buffer (gdb-get-source-buffer))))
+
+(defun my-gud-comint-set-prompt-regexp ()
+ (setq comint-prompt-regexp "\\((rr)|(gdb)\\) "))
+
+(defun my-file-loc-to-github (file-loc &optional revision)
+ "Convert a file location to a github url."
+ (pcase-let* ((`(,file ,line-no) (split-string file-loc ":"))
+ (revision (or revision (vc-working-revision file)))
+ (repo-url (vc-git-repository-url file))
+ (repo-root (vc-git-root file))
+ (path (file-relative-name file repo-root)))
+ (format "%s/blob/%s/%s#L%s" repo-url revision path line-no)))
+
+(defun my-org-backtrace-to-github (bt &optional revision)
+ (string-join
+ (mapcar
+ (lambda (link)
+ (string-match "\\[\\[\\(.*\\)\\]\\[\\(.*\\)\\]\\]" link)
+ (let ((target (match-string 1 link))
+ (label (match-string 2 link)))
+ (format "[[%s][%s]]"
+ (my-file-loc-to-github target revision)
+ label)))
+ (split-string bt " > "))
+ " > "))
+
+(defun my-org-backtrace-to-github-region (beg end)
+ (interactive "r")
+ (kill-new
+ (my-org-backtrace-to-github (buffer-substring-no-properties beg end))))
+
+(defun my-org-backtrace-to-github-slack (beg end)
+ (interactive "r")
+ (let ((bt (buffer-substring-no-properties beg end))
+ (revision (when current-prefix-arg
+ (read-string "Rrevision: ")))
+ )
+ (with-temp-buffer
+ (insert "#+options: ^:nil
+")
+ (goto-char (point-max))
+ (insert (my-org-backtrace-to-github bt revision))
+ (org-md-export-as-markdown))))
+
+;;; which-func
+(defun my-copy-which-func ()
+ (interactive)
+ (kill-new (which-function))
+ )
+
+(defun my-set-header-line-to-which-func ()
+ (setq header-line-format
+ '((which-func-mode
+ ("" which-func-format " ")
+ ))))
+
+;; override bookmark-make-record for easier default bookmark name.
+(defun my-bookmark-make-record ()
+ "Return a new bookmark record (NAME . ALIST) for the current location."
+ (let ((record (funcall bookmark-make-record-function)))
+ ;; Set up default name if the function does not provide one.
+ (unless (stringp (car record))
+ (if (car record) (push nil record))
+ (setcar record (or bookmark-current-bookmark (bookmark-buffer-name))))
+ ;; Set up defaults.
+ (bookmark-prop-set
+ record 'defaults
+ (delq nil (delete-dups (append (bookmark-prop-get record 'defaults)
+ (list (which-function)
+ bookmark-current-bookmark
+ (car record)
+ (bookmark-buffer-name))))))
+ record))
+
+;;; bison-mode
+(require 'bison-mode)
+(defun my-bison-imenu-create-index ()
+ (let ((end))
+ (beginning-of-buffer)
+ (re-search-forward "^%%")
+ (forward-line 1)
+ (setq end (save-excursion
+ (when (re-search-forward "^%%" nil t) (point))))
+ (loop while (re-search-forward "^\\([a-z].*?\\)\\s-*\n?\\s-*:" end t)
+ collect (cons (match-string 1) (point)))))
+(defun my-bison-set-imenu-create-index-function ()
+ (setq imenu-create-index-function
+ 'my-bison-imenu-create-index))
+
+;;; json-mode
+(require 'json-mode)
+(defun my-json-mode-path ()
+ (string-join
+ (mapcar 'prin1-to-string (plist-get (json-path-to-position (point)) :path))
+ "/"))
+
+(defun my-json-set-header-line-to-path ()
+ (setq header-line-format
+ '((:eval (my-json-mode-path)))))
+
+;;; eglot
+(defun my-eglot-format-buffer-when-managed ()
+ (when (eglot-managed-p)
+ (unless (derived-mode-p 'haskell-mode 'c-mode 'c++-mode)
+ (eglot-format-buffer))))
+
(provide 'my-prog)
;;; my-prog.el ends here
diff --git a/emacs/.emacs.d/lisp/org-jira b/emacs/.emacs.d/lisp/org-jira
new file mode 160000
+Subproject 63a74d4458f512f0825e9f55491baad3ee4e9c4
diff --git a/emacs/.emacs.d/lisp/ox-jira.el b/emacs/.emacs.d/lisp/ox-jira.el
new file mode 160000
+Subproject 00184f8fdef02a3a359a253712e8769cbfbea3b
diff --git a/mariadb-server/storage/spider/.dir-locals.el b/mariadb-server/storage/spider/.dir-locals.el
new file mode 100644
index 0000000..644ec45
--- /dev/null
+++ b/mariadb-server/storage/spider/.dir-locals.el
@@ -0,0 +1,12 @@
+((c++-mode
+ . ((c-file-style . "maria-spider")
+ (comment-start . "/* ")
+ (comment-end . " */")
+ (comment-continue . " ")
+ (comment-style . extra-line)))
+ (c-mode
+ . ((c-file-style . "maria-spider")
+ (comment-start . "/* ")
+ (comment-end . " */")
+ (comment-continue . " ")
+ (comment-style . extra-line))))
diff --git a/misc/.bashrc b/misc/.bashrc
index 976451d..3212c87 100644
--- a/misc/.bashrc
+++ b/misc/.bashrc
@@ -9,6 +9,8 @@ esac
export EDITOR="emacsclient -c -a emacs" # $EDITOR opens in terminal
export VISUAL="emacsclient -c -a emacs" # $VISUAL opens in GUI mode
+export LC_ALL="en_AU.utf8"
+
# Shorter version of a common command that it used herein.
_checkexec ()
{
@@ -20,7 +22,11 @@ source ~/.bashrc_local
## prompts
# git prompt
-source /usr/share/git/completion/git-prompt.sh
+if [[ -f /usr/share/git/completion/git-prompt.sh ]]; then
+ source /usr/share/git/completion/git-prompt.sh
+elif [[ -f /etc/bash_completion.d/git-prompt ]]; then
+ source /etc/bash_completion.d/git-prompt
+fi
# prompt
RESET="\[\033[0m\]"
@@ -73,8 +79,6 @@ fi
export MANPAGER="$PAGER"
-export LC_ALL=en_GB.utf8
-
# Enter directory and list contents
cd ()
{
@@ -137,6 +141,9 @@ alias cp='cp -iv'
alias mv='mv -iv'
alias rm='rm -iv'
+# git
+alias gcgrep='git log --pretty=format:"%h %ad - %an: %<(80,trunc)%s" | grep'
+
# pacman package manager
if _checkexec pacman
then
@@ -175,6 +182,9 @@ then
alias pcache0="sudo paccache -ruk0" # remove all cache
fi
+# from ~/.bashrc_local, more aliases
+my_local_aliases
+
#ibus
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
diff --git a/misc/bin/gdb-mi.sh b/misc/bin/gdb-mi.sh
new file mode 100644
index 0000000..39320b5
--- /dev/null
+++ b/misc/bin/gdb-mi.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+gdb -i=mi "$@"