I have the following line in my Emacs init file.
(global-set-key (kbd "C-x a r") 'align-regexp)
Is there any way to hard-code in a particular regex so that I don't have to specify it every time?
I have the following line in my Emacs init file.
(global-set-key (kbd "C-x a r") 'align-regexp)
Is there any way to hard-code in a particular regex so that I don't have to specify it every time?
You could just bind that key-sequence to a keyboard-macro:
(fset 'my-align-regexp
[?\M-x ?a ?l ?i ?g ?n ?- ?r ?e ?g ?e ?x ?p return ?f ?o ?o return])
(global-set-key (kbd "C-x a r") 'my-align-regexp)
Create a keyboard macro with M-xalign-regexp
then enter your regex.
Then insert the macro into your .emacs file with M-xinsert-kbd-macro
return return
You could create your own command with the hard-coded regexp like so:
(defun align-specific-regexp (beg end)
"Call 'align-regexp with the regexp ..."
(interactive "r")
(align-regexp beg end "^some.*regexp\\(here\\)?"))