aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp/my/my-mariadb.el
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2023-06-19 11:19:19 +1000
committerYuchen Pei <id@ypei.org>2023-06-19 22:41:03 +1000
commit06914aff2b0011d41bc50447965a8d7c6ef52c9b (patch)
tree278047a8c1c02347d5cf7a0119ac4cc373e3e191 /emacs/.emacs.d/lisp/my/my-mariadb.el
parentf06c1c12456a598b7007a6ef08306051d0d49064 (diff)
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
Diffstat (limited to 'emacs/.emacs.d/lisp/my/my-mariadb.el')
-rw-r--r--emacs/.emacs.d/lisp/my/my-mariadb.el126
1 files changed, 126 insertions, 0 deletions
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