mirror of
https://codeberg.org/scip/dot-emacs.git
synced 2025-12-17 12:30:59 +01:00
+fixxx%
This commit is contained in:
28
.emacs
28
.emacs
@@ -1,4 +1,4 @@
|
|||||||
;; Toms Emacs Config - portable - version (20181109.01) -*-emacs-lisp-*-
|
;; Toms Emacs Config - portable - version (20181110.01) -*-emacs-lisp-*-
|
||||||
;; * Introduction
|
;; * Introduction
|
||||||
|
|
||||||
;; This is my emacs config, it is more than twenty years old. It
|
;; This is my emacs config, it is more than twenty years old. It
|
||||||
@@ -690,6 +690,11 @@
|
|||||||
;; - fixed function, inserts at ()
|
;; - fixed function, inserts at ()
|
||||||
;; - added / to dired hydra
|
;; - added / to dired hydra
|
||||||
|
|
||||||
|
;; 20181110.01
|
||||||
|
;; - fixed % function, really
|
||||||
|
;; - fixed elisp autoscratch config
|
||||||
|
|
||||||
|
|
||||||
;; ** TODO
|
;; ** TODO
|
||||||
|
|
||||||
;; - check helpful https://github.com/wilfred/helpful
|
;; - check helpful https://github.com/wilfred/helpful
|
||||||
@@ -717,7 +722,7 @@
|
|||||||
;; My emacs config has a version (consisting of a timestamp with a
|
;; My emacs config has a version (consisting of a timestamp with a
|
||||||
;; serial), which I display in the mode line. So I can clearly see, if
|
;; serial), which I display in the mode line. So I can clearly see, if
|
||||||
;; I'm using an outdated config somewhere.
|
;; I'm using an outdated config somewhere.
|
||||||
(defvar tvd-emacs-version "20181109.01")
|
(defvar tvd-emacs-version "20181110.01")
|
||||||
|
|
||||||
;; --------------------------------------------------------------------------------
|
;; --------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -1254,7 +1259,9 @@ to next buffer otherwise."
|
|||||||
(setq autoscratch-triggers-alist
|
(setq autoscratch-triggers-alist
|
||||||
'(("[(;]" . (progn
|
'(("[(;]" . (progn
|
||||||
(emacs-lisp-mode)
|
(emacs-lisp-mode)
|
||||||
(electric-indent-local-mode t)))
|
(electric-indent-local-mode t)
|
||||||
|
(paredit-mode t)
|
||||||
|
(electric-pair-mode t)))
|
||||||
("#" . (progn
|
("#" . (progn
|
||||||
(config-general-mode)
|
(config-general-mode)
|
||||||
(electric-indent-local-mode t)))
|
(electric-indent-local-mode t)))
|
||||||
@@ -1493,7 +1500,7 @@ window, third in a row goes to end of buffer."
|
|||||||
(global-set-key (kbd "<f8>") 'goto-percent) ;F8 goto percent
|
(global-set-key (kbd "<f8>") 'goto-percent) ;F8 goto percent
|
||||||
|
|
||||||
;; --------------------------------------------------------------------------------
|
;; --------------------------------------------------------------------------------
|
||||||
;; ** Simulate vi's % function
|
;; ** Simulate vi's % (percent) function
|
||||||
|
|
||||||
;; There's not a lot about vi[m] I like, but jumping with % to a
|
;; There's not a lot about vi[m] I like, but jumping with % to a
|
||||||
;; matching paren is one of THOSE features, I also need in emacs.
|
;; matching paren is one of THOSE features, I also need in emacs.
|
||||||
@@ -1502,18 +1509,19 @@ window, third in a row goes to end of buffer."
|
|||||||
|
|
||||||
;; If (point) is on a paren, jump to the matching paren, otherwise,
|
;; If (point) is on a paren, jump to the matching paren, otherwise,
|
||||||
;; just insert a literal ?%. Only make sense if bound to %.
|
;; just insert a literal ?%. Only make sense if bound to %.
|
||||||
|
;; Does not jump in inside () though
|
||||||
(defun jump-paren-match-or-insert-percent (arg)
|
(defun jump-paren-match-or-insert-percent (arg)
|
||||||
"Go to the matching parenthesis if on parenthesis. Otherwise
|
"Go to the matching parenthesis if on parenthesis. Otherwise
|
||||||
insert %. Mimics vi style of % jumping to matching brace."
|
insert %. Mimics vi stle of % jumping to matching brace."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(cond ((looking-at "\\s\(\\|\{\\|\\[") (forward-list 1) (backward-char 1))
|
(cond ((looking-at "\\s\(\\|\{\\|\\[") (forward-list 1) (backward-char 1))
|
||||||
((looking-at "\\s\)\\|\}\\|\\]")
|
((and (looking-at "\\s\)\\|\}\\|\\]")
|
||||||
(if (looking-back "\\s\(\\|\{\\|\\[")
|
(not (looking-back "\\s\(\\|\{\\|\\[")))
|
||||||
(insert "%")
|
|
||||||
(forward-char 1) (backward-list 1))
|
(forward-char 1) (backward-list 1))
|
||||||
(t (insert "%")))))
|
(t (insert "%"))))
|
||||||
|
|
||||||
(global-set-key (kbd "%") 'jump-paren-match-or-insert-percent)
|
;; only useful in programming modes
|
||||||
|
(define-key prog-mode-map (kbd "%") 'jump-paren-match-or-insert-percent)
|
||||||
|
|
||||||
;; --------------------------------------------------------------------------------
|
;; --------------------------------------------------------------------------------
|
||||||
;; ** Move region
|
;; ** Move region
|
||||||
|
|||||||
Reference in New Issue
Block a user