aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/init/ycp-prog.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/init/ycp-prog.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/init/ycp-prog.el')
-rw-r--r--emacs/.emacs.d/init/ycp-prog.el107
1 files changed, 97 insertions, 10 deletions
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