Skip to content

Commit

Permalink
Using tab-always-indent now to control tab key behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
chaosemer committed May 31, 2024
1 parent 11a06ba commit a48672f
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions emacs.el
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
(setf minor-mode-alist (assoc-delete-all 'form-feed-st-mode minor-mode-alist)))
(progn (global-subword-mode 1)
(setf minor-mode-alist (assoc-delete-all 'subword-mode minor-mode-alist)))
(setf (default-value 'indent-tabs-mode) nil)
(setf (default-value 'indent-tabs-mode) nil
tab-always-indent 'complete)
(recentf-mode 1)
(tooltip-mode -1)
(url-handler-mode 1)
Expand Down Expand Up @@ -160,10 +161,6 @@
(keymap-global-set "M-<home>" 'beginning-of-defun)
(keymap-global-set "M-<end>" 'end-of-defun)

;; Use C-<tab> for all M-TAB commands as Windows uses M-TAB for window
;; switching.
(keymap-set key-translation-map "C-<tab>" (key-parse "M-TAB"))

;; simpler sexp bindings
(keymap-global-set "M-<right>" 'forward-sexp)
(keymap-global-set "M-<left>" 'backward-sexp)
Expand Down Expand Up @@ -268,21 +265,3 @@ FILE: File to find the sibling file of."
(keymap-global-set "C-x 4 h" 'find-sibling-file-other-window)
(keymap-global-set "C-x 5 C-h" 'find-sibling-file-other-frame)
(keymap-global-set "C-x 5 h" 'find-sibling-file-other-frame)

;;; Other misc stuff TODO(package)
(defun indent-dwim (arg)
"Try to do what a human would mean when indenting.
The prefix argument ARG, if given, indents to that column."
(interactive (list current-prefix-arg))

(cond (mark-active
(indent-region (region-beginning) (region-end) arg))
(arg
(save-excursion
(beginning-of-line)
(delete-horizontal-space)
(indent-to (prefix-numeric-value arg))))
(t
(indent-according-to-mode))))
(keymap-global-set "TAB" 'indent-dwim)

0 comments on commit a48672f

Please sign in to comment.