aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emacs/.emacs.d/init/ycp-complete.el1
-rw-r--r--emacs/.emacs.d/init/ycp-editing.el4
-rw-r--r--emacs/.emacs.d/init/ycp-org.el2
-rw-r--r--emacs/.emacs.d/lisp/my/my-buffer.el13
-rw-r--r--emacs/.emacs.d/lisp/my/my-editing.el50
-rw-r--r--emacs/.emacs.d/lisp/my/my-mariadb.el23
-rw-r--r--emacs/.emacs.d/lisp/my/my-net.el13
-rw-r--r--emacs/.emacs.d/lisp/my/my-org-jira.el163
-rw-r--r--emacs/.emacs.d/lisp/my/my-prog.el1
-rw-r--r--mariadb-server/.dir-locals.el34
-rw-r--r--mariadb-server/sql/.dir-locals.el33
11 files changed, 205 insertions, 132 deletions
diff --git a/emacs/.emacs.d/init/ycp-complete.el b/emacs/.emacs.d/init/ycp-complete.el
index 16ddbfe..c088356 100644
--- a/emacs/.emacs.d/init/ycp-complete.el
+++ b/emacs/.emacs.d/init/ycp-complete.el
@@ -155,6 +155,7 @@
#'my-corfu-enable-always-in-minibuffer 1)
;;; corfu does not work well in gud as it "flushes" completion
;;; suggestions to the buffer
+ ;;; https://github.com/minad/corfu/issues/157
(setq global-corfu-modes '((not gud-mode) t))
)
diff --git a/emacs/.emacs.d/init/ycp-editing.el b/emacs/.emacs.d/init/ycp-editing.el
index 81a46b1..8e6a49e 100644
--- a/emacs/.emacs.d/init/ycp-editing.el
+++ b/emacs/.emacs.d/init/ycp-editing.el
@@ -94,6 +94,7 @@
"<C-M-backspace>" #'backward-kill-sexp
"C-M-/" #'my-mark-backward-up-list
"C-M-k" #'my-kill-sexp-or-comment
+ "C-x C-w" #'my-write-file
)
(electric-pair-mode)
(my-add-hooks #'my-non-special-modes-setup '(text-mode-hook prog-mode-hook))
@@ -108,7 +109,8 @@
(setq viper-mode nil)
(my-package viper
- (:delay 60))
+ (:delay 60)
+ (setq viper-syntax-preference 'extended))
(define-key global-map [f2] 'revert-buffer)
diff --git a/emacs/.emacs.d/init/ycp-org.el b/emacs/.emacs.d/init/ycp-org.el
index 2481cab..430335a 100644
--- a/emacs/.emacs.d/init/ycp-org.el
+++ b/emacs/.emacs.d/init/ycp-org.el
@@ -58,6 +58,8 @@
my-org-doc-dir)
;; disable auto-indent on RET
(add-hook 'org-mode-hook (lambda () (electric-indent-local-mode -1)))
+ ;; tab-width 8 is needed for newer versions of org-mode, which I am
+ ;; not using due to performance issues
(add-hook 'org-mode-hook (lambda () (setq-local tab-width 2)))
;; The world does not end by 2038 (hopefully)
diff --git a/emacs/.emacs.d/lisp/my/my-buffer.el b/emacs/.emacs.d/lisp/my/my-buffer.el
index ef988f8..21401b5 100644
--- a/emacs/.emacs.d/lisp/my/my-buffer.el
+++ b/emacs/.emacs.d/lisp/my/my-buffer.el
@@ -458,5 +458,18 @@ With double prefix arguments, create a new indirect buffer."
(4 (my-switch-indirect-buffer))
(_ (my-cycle-indirect-buffer))))
+(defun my-save-text-and-switch-to-buffer (text file-name)
+ "Save TEXT to FILE-NAME and switch to buffer."
+ (let ((buffer (find-file-noselect file-name))
+ (coding-system-for-write 'utf-8))
+ (with-current-buffer buffer
+ (let ((inhibit-read-only t))
+ (erase-buffer)
+ (insert text))
+ (goto-char (point-min))
+ (save-buffer)
+ (revert-buffer t t))
+ (switch-to-buffer buffer)))
+
(provide 'my-buffer)
;;; my-buffer.el ends here
diff --git a/emacs/.emacs.d/lisp/my/my-editing.el b/emacs/.emacs.d/lisp/my/my-editing.el
index aa65ba1..0775063 100644
--- a/emacs/.emacs.d/lisp/my/my-editing.el
+++ b/emacs/.emacs.d/lisp/my/my-editing.el
@@ -90,7 +90,7 @@
(interactive)
(zap-up-to-char -1 ?/))
-(defun my-toggle-forward-word-viper-symbol ()
+(defun my-toggle-forward-word-symbol ()
(interactive)
(require 'viper)
(cond ((eq (lookup-key (current-global-map) "\M-f") 'forward-word)
@@ -102,14 +102,47 @@
(progn
(define-key global-map "\M-f" 'forward-symbol)
(define-key global-map "\M-b"
- (lambda () (interactive)
- (forward-symbol -1)))
+ (lambda () (interactive)
+ (forward-symbol -1)))
(message "M-f is forward-symbol")))
(t (progn
(define-key global-map "\M-f" 'forward-word)
(define-key global-map "\M-b" 'backward-word)
(message "M-f is forward-word")))))
+;;; todo: move to my-viper
+;;; do not skip underscore
+(defun viper-forward-word-kernel (val)
+ (while (> val 0)
+ (cond ((viper-looking-at-alpha)
+ (viper-skip-alpha-forward "")
+ (viper-skip-separators t))
+ ((viper-looking-at-separator)
+ (viper-skip-separators t))
+ ((not (viper-looking-at-alphasep))
+ (viper-skip-nonalphasep-forward)
+ (viper-skip-separators t)))
+ (setq val (1- val))))
+
+(defun viper-backward-word-kernel (val)
+ (while (> val 0)
+ (viper-backward-char-carefully)
+ (cond ((viper-looking-at-alpha)
+ (viper-skip-alpha-backward ""))
+ ((viper-looking-at-separator)
+ (forward-char)
+ (viper-skip-separators nil)
+ (viper-backward-char-carefully)
+ (cond ((viper-looking-at-alpha)
+ (viper-skip-alpha-backward "_"))
+ ((not (viper-looking-at-alphasep))
+ (viper-skip-nonalphasep-backward))
+ ((bobp)) ; could still be at separator, but at beg of buffer
+ (t (forward-char))))
+ ((not (viper-looking-at-alphasep))
+ (viper-skip-nonalphasep-backward)))
+ (setq val (1- val))))
+
(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
@@ -525,5 +558,16 @@ With an prefix-arg, copy the file name relative to project root."
(defun my-turn-off-truncate-lines ()
(setq truncate-lines nil))
+(defun my-write-file ()
+ "Same as `write-file', but keep the old buffer and remain there.
+
+In other words, create a new buffer with the same content and
+execute `write-file', then switch back to the current buffer."
+ (interactive)
+ (let ((old-buffer (current-buffer)))
+ (with-temp-buffer
+ (insert-buffer-substring old-buffer)
+ (call-interactively 'write-file))))
+
(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 52ca8bc..6b0e06b 100644
--- a/emacs/.emacs.d/lisp/my/my-mariadb.el
+++ b/emacs/.emacs.d/lisp/my/my-mariadb.el
@@ -56,14 +56,14 @@
(when (and (buffer-live-p gud-comint-buffer)
(get-buffer-process gud-comint-buffer))
(my-gdb-quit))
- (sleep-for 1)
+ ;; (sleep-for 1)
(my-gdb
(format "rr replay %s -d %s"
(expand-file-name
(replace-regexp-in-string
"/src"
"/build/mysql-test/var/log/mysqld.1.1.rr/latest-trace"
- ;; "/build/mysql-test/var/log/mysqld.3.1.rr/latest-trace"
+ ;; "/build/mysql-test/var/log/mysqld.2.2.rr/latest-trace"
(project-root (project-current t))))
(expand-file-name "~/bin/gdb-mi.sh"))))
@@ -251,5 +251,24 @@ enum spider_malloc_id {
nil t)
(tempel-insert 'ps)))
+(defun my-mariadb-fetch-kb-source (url)
+ "Fetches the source to an maridb kb entry at URL.
+
+The source is saved in a .wiki file under the /tmp dir, and it
+switches to the buffer."
+ (interactive "sURL: ")
+ (let* ((term
+ (progn
+ (string-match "https://mariadb.com/kb/en/\\([^/]+\\)/" url)
+ (match-string 1 url)))
+ (source
+ (dom-text
+ (dom-by-id
+ (my-url-fetch-dom
+ (format "https://mariadb.com/kb/en/%s/+source/" term))
+ "answer_source")))
+ (file-name (format "/tmp/%s.wiki" term)))
+ (my-save-text-and-switch-to-buffer source file-name)))
+
(provide 'my-mariadb)
;;; my-mariadb.el ends here
diff --git a/emacs/.emacs.d/lisp/my/my-net.el b/emacs/.emacs.d/lisp/my/my-net.el
index 0eafb7a..1f1cbc6 100644
--- a/emacs/.emacs.d/lisp/my/my-net.el
+++ b/emacs/.emacs.d/lisp/my/my-net.el
@@ -80,18 +80,9 @@ It checks the STATUS, and if it is ok, saves the payload to FILE-NAME."
(when (plist-get status :error)
(error "My fetch failed: %s" (plist-get status :error)))
(my-delete-http-header)
- (let ((to-insert (buffer-string))
- (buffer (find-file-noselect file-name))
- (coding-system-for-write 'utf-8))
+ (let ((to-insert (buffer-string)))
(kill-buffer)
- (with-current-buffer buffer
- (let ((inhibit-read-only t))
- (erase-buffer)
- (insert to-insert))
- (goto-char (point-min))
- (save-buffer)
- (revert-buffer t t))
- (switch-to-buffer buffer))
+ (my-save-text-and-switch-to-buffer to-insert file-name))
)
(defun my-kill-http-header ()
diff --git a/emacs/.emacs.d/lisp/my/my-org-jira.el b/emacs/.emacs.d/lisp/my/my-org-jira.el
index 7ff7738..8f716c3 100644
--- a/emacs/.emacs.d/lisp/my/my-org-jira.el
+++ b/emacs/.emacs.d/lisp/my/my-org-jira.el
@@ -34,91 +34,92 @@
"Render single ISSUE."
;; (org-jira-log "Rendering issue from issue list")
;; (org-jira-log (org-jira-sdk-dump Issue))
+ ;; (print 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))))))))
+ (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 affected-versions fix-versions labels resolution status components created updated sprint related-issues))
+
+ (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 ()
diff --git a/emacs/.emacs.d/lisp/my/my-prog.el b/emacs/.emacs.d/lisp/my/my-prog.el
index 9c75a22..ffb0d26 100644
--- a/emacs/.emacs.d/lisp/my/my-prog.el
+++ b/emacs/.emacs.d/lisp/my/my-prog.el
@@ -461,6 +461,7 @@ left and the source buffer on the right.
(auto-fill-mode)
(display-line-numbers-mode)
(setq tab-width 2)
+ (setq indent-tabs-mode nil)
(bug-reference-prog-mode)
(flyspell-prog-mode))
diff --git a/mariadb-server/.dir-locals.el b/mariadb-server/.dir-locals.el
index 595eb5b..2b4cff5 100644
--- a/mariadb-server/.dir-locals.el
+++ b/mariadb-server/.dir-locals.el
@@ -1,3 +1,35 @@
((nil . ((bug-reference-bug-regexp . "\\<\\(\\)\\([Mm][Dd][Ee][Vv]-[0-9]+\\)\\>")
(bug-reference-url-format . "https://jira.mariadb.org/browse/%s")))
- )
+ (c++-mode
+ . ((indent-tabs-mode . nil)
+ (c-file-style . "linux")
+ (c-basic-offset . 2)
+ (c-offsets-alist
+ . (
+ (inline-open . 0)
+ (substatement . +)
+ (statement-block-intro . +)
+ (arglist-cont-nonempty c-lineup-gcc-asm-reg c-lineup-arglist)
+ (inclass . +)
+ (defun-block-intro . +)
+ ))
+ (comment-start . "/* ")
+ (comment-end . " */")
+ (comment-continue . " ")
+ (comment-style . extra-line)))
+ (c-mode
+ . ((indent-tabs-mode . nil)
+ (c-file-style . "linux")
+ (c-basic-offset . 2)
+ (c-offsets-alist
+ . (
+ (inline-open . 0)
+ (substatement . +)
+ (statement-block-intro . +)
+ (arglist-cont-nonempty c-lineup-gcc-asm-reg c-lineup-arglist)
+ (inclass . +)
+ ))
+ (comment-start . "/* ")
+ (comment-end . " */")
+ (comment-continue . " ")
+ (comment-style . extra-line))))
diff --git a/mariadb-server/sql/.dir-locals.el b/mariadb-server/sql/.dir-locals.el
deleted file mode 100644
index 2daa20a..0000000
--- a/mariadb-server/sql/.dir-locals.el
+++ /dev/null
@@ -1,33 +0,0 @@
-((c++-mode
- . ((indent-tabs-mode . nil)
- (c-file-style . "linux")
- (c-basic-offset . 2)
- (c-offsets-alist
- . (
- (inline-open . 0)
- (substatement . +)
- (statement-block-intro . +)
- (arglist-cont-nonempty c-lineup-gcc-asm-reg c-lineup-arglist)
- (inclass . +)
- (defun-block-intro . +)
- ))
- (comment-start . "/* ")
- (comment-end . " */")
- (comment-continue . " ")
- (comment-style . extra-line)))
- (c-mode
- . ((indent-tabs-mode . nil)
- (c-file-style . "linux")
- (c-basic-offset . 2)
- (c-offsets-alist
- . (
- (inline-open . 0)
- (substatement . +)
- (statement-block-intro . +)
- (arglist-cont-nonempty c-lineup-gcc-asm-reg c-lineup-arglist)
- (inclass . +)
- ))
- (comment-start . "/* ")
- (comment-end . " */")
- (comment-continue . " ")
- (comment-style . extra-line))))