Skip to content

Commit

Permalink
Organizing files per general conventions.
Browse files Browse the repository at this point in the history
  • Loading branch information
chaosemer committed Dec 12, 2023
1 parent cc3f430 commit 5baeeba
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 37 deletions.
30 changes: 18 additions & 12 deletions c.el
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
(c-set-offset 'member-init-intro '++)
(c-set-offset 'cpp-macro 0)
(c-set-offset 'statement-case-open '+)
(keymap-local-set "C-c M-<right>" 'c-forward-conditional)
(keymap-local-set "C-c M-<left>" 'c-backward-conditional)
(keymap-local-set "C-c M-<up>" 'c-up-conditional-with-else)
(keymap-local-set "C-c M-<down>" 'c-down-conditional)
(when (fboundp 'cscope-bind-keys-3deep) (cscope-bind-keys-3deep))

;; Special comment syntax
Expand All @@ -24,14 +20,7 @@

(setf beginning-of-defun-function 'my-c-beginning-of-defun)

;; ebrowse's default prefix key binding of "C-c C m -" is EXTREMELY
;; inconvenient. Nothing else uses C-c C, so I'm moving it to that.
(require 'ebrowse)
(keymap-global-set "C-c C" ebrowse-global-map)

;; cc-mode defines the tab key in its map. It shouldn't TODO(upstream)
(keymap-unset c-mode-map "TAB")
(keymap-unset c++-mode-map "TAB"))
(require 'ebrowse))

(setf (default-value 'c-recognize-knr-p) nil
(default-value 'c-recognize-paren-inits) t
Expand All @@ -43,6 +32,23 @@
(lambda () (when (member major-mode '(c-mode c++-mode))
(hide-ifdef-mode 1)))
t)

;;; Keymaps:
(keymap-set c-mode-base-map "C-c M-<right>" 'c-forward-conditional)

Check warning on line 37 in c.el

View workflow job for this annotation

GitHub Actions / test (29.1, byte-compile)

reference to free variable ‘c-mode-base-map’
(keymap-set c-mode-base-map "C-c M-<left>" 'c-backward-conditional)
(keymap-set c-mode-base-map "C-c M-<up>" 'c-up-conditional-with-else)
(keymap-set c-mode-base-map "C-c M-<down>" 'c-down-conditional)

;; ebrowse's default prefix key binding of "C-c C m -" is EXTREMELY
;; inconvenient. Nothing else uses C-c C, so I'm moving it to that.
(setf ebrowse-global-prefix-key (kbd "C-c C"))

;; cc-mode defines the tab key in its map. It shouldn't TODO(upstream)
(with-eval-after-load 'cc-mode
(keymap-unset c-mode-map "TAB")
(keymap-unset c++-mode-map "TAB"))

;;; Custom commands:

;; Make CC-Mode's defun finding include any function comments that
;; immediately preceede it.
Expand Down
11 changes: 6 additions & 5 deletions diff.el
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
;;; init/diff.el --- Diff mode customizations -*- lexical-binding: t; -*-

Check warning on line 1 in diff.el

View workflow job for this annotation

GitHub Actions / test (29.1, checkdoc)

You should have a section marked ";;; Commentary:"

;;; Code:

;;; Kemaps:
;; VC should use EDiff, as it provides a better visualization.
(keymap-global-set "<remap> <vc-diff>" 'vc-ediff)

;;; Custom commands:
(defun hexl-find-file-noselect (file)
"Find a file and put it into `hexl-mode'.
Expand Down Expand Up @@ -35,6 +39,3 @@ FILE3: Path to the third file."
(read-file-name "File B to compare: ")
(read-file-name "File C to compare: ")))
(apply #'ediff-buffers3 (mapcar #'hexl-find-file-noselect (list file1 file2 file3))))

;; VC should use EDiff, as it provides a better visualization.
(keymap-global-set "<remap> <vc-diff>" 'vc-ediff)
11 changes: 7 additions & 4 deletions dired.el
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@

;; Single buffer at a time
dired-kill-when-opening-new-dired-buffer t)


;;; Keymaps:
(with-eval-after-load 'dired
(keymap-set dired-mode-map "v" 'my-dired-vc-dir)
(keymap-set dired-mode-map "<mouse-2>" #'dired-mouse-find-file))

(keymap-set dired-mode-map "v" 'my-dired-vc-dir))

;;; Custom commands:
(defun my-dired-vc-dir ()
"Show VC status for the currently displayed directory."
(interactive)
(unless (eq major-mode 'dired-mode)
(error "`my-dired-vc-dir' only works in Dired mode"))
(vc-dir (dired-current-directory)))
(with-eval-after-load 'dired
(keymap-set dired-mode-map "<mouse-2>" #'dired-mouse-find-file))
11 changes: 8 additions & 3 deletions elisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

;;; Code:
(hook-mode emacs-lisp-mode-hook
eldoc-mode
(font-lock-add-keywords nil '(("^\\s *;;;.*\n?" (0 'section-comment-face t))
("^;;;;.*\n?" (0 'file-comment-face t)))))
eldoc-mode)
(hook-mode ielm-mode-hook
eldoc-mode)

;;; Faces:
(font-lock-add-keywords 'emacs-lisp-mode
'(("^\\s *;;;.*\n?" (0 'section-comment-face t))
("^;;;;.*\n?" (0 'file-comment-face t))))

;;; Keymaps:

;; emacs-lisp-mode defines the tab key in its map. It shouldn't TODO(upstream)
(keymap-unset emacs-lisp-mode-map "TAB")
6 changes: 4 additions & 2 deletions hexl.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
(hexl-follow-line)
(hexl-activate-ruler)
(turn-on-eldoc-mode)
(setf truncate-lines t))

(setf truncate-lines t)))

;;; Custom commands:
(with-eval-after-load 'hexl
(keymap-set hexl-mode-map "<remap> <self-insert-command>"
'hexl-my-self-insert-command)
(keymap-set hexl-mode-map "C-m" 'hexl-my-self-insert-command)
Expand Down
14 changes: 6 additions & 8 deletions lisp.el
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
;;; init/lisp.el --- (Common) Lisp customizations -*- lexical-binding: t; -*-

;;; Code:
(cl-pushnew '("\\.asd\\'" . lisp-mode) auto-mode-alist :test #'equal)

(hook-mode lisp-mode-hook
(make-variable-buffer-local 'browse-url-browser-function)
(setf browse-url-browser-function 'w3m)
Expand All @@ -11,10 +9,10 @@

(require 'slime)
(setf inferior-lisp-program "sbcl")
(slime-setup)
;; Key bindings
(keymap-local-set "C-<down-mouse-3>" (lambda () (interactive)
(popup-menu slime-easy-menu))))

(slime-setup))
(cl-pushnew '("\\.asd\\'" . lisp-mode) auto-mode-alist :test #'equal)

;;; Keymaps:
(keymap-set lisp-mode-map "C-<down-mouse-3>" (lambda () (interactive)
(popup-menu slime-easy-menu)))
(keymap-unset lisp-mode-map "TAB")
9 changes: 6 additions & 3 deletions text.el
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@
(electric-pair-local-mode -1)
(markdown-toggle-markup-hiding 1))

;; Actually, I prefer GitHub flavored markdown
(add-to-list 'major-mode-remap-alist '(markdown-mode . gfm-mode))

;; Make sure we delete selection on highlight.
(put 'markdown-enter-key 'delete-selection t)

(setf markdown-fontify-code-blocks-natively t)

;;; Keymaps:
(with-eval-after-load 'markdown-mode
;; Make markdown mode always indent / unintent with TAB / S-TAB
(keymap-set markdown-mode-map "TAB" 'markdown-demote-list-item)
(keymap-set markdown-mode-map "<backtab>" 'markdown-promote-list-item))

;; Actually, I prefer GitHub flavored markdown
(add-to-list 'major-mode-remap-alist '(markdown-mode . gfm-mode))
2 changes: 2 additions & 0 deletions vc.el
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
;;; init/vc.el --- Customizing Version Control menus and such -*- lexical-binding: t; -*-

;;; Code:

;;; Custom commands:
(with-eval-after-load 'vc-git
(keymap-set vc-git-extra-menu-map "<git-svn-dcommit>"
'(menu-item "Git SVN Commit" vc-git-svn-dcommit))
Expand Down

0 comments on commit 5baeeba

Please sign in to comment.