emacs: Move pp^L configuration to org
This commit is contained in:
parent
b9c0e3838f
commit
3e5421e79d
3 changed files with 108 additions and 86 deletions
|
@ -151,8 +151,6 @@
|
||||||
(setq php-function-call-face 'font-lock-function-name-face)
|
(setq php-function-call-face 'font-lock-function-name-face)
|
||||||
(setq php-mode-force-pear t)
|
(setq php-mode-force-pear t)
|
||||||
(setq pony-tpl-indent-moves t)
|
(setq pony-tpl-indent-moves t)
|
||||||
(setq pp^L-^L-string-function 'oni:pretty-control-l-function)
|
|
||||||
(setq pp^L-^L-string-pre nil)
|
|
||||||
(setq rainbow-delimiters-max-face-count 12)
|
(setq rainbow-delimiters-max-face-count 12)
|
||||||
(setq redisplay-dont-pause t)
|
(setq redisplay-dont-pause t)
|
||||||
(setq send-mail-function 'smtpmail-send-it)
|
(setq send-mail-function 'smtpmail-send-it)
|
||||||
|
|
|
@ -216,95 +216,126 @@
|
||||||
'(python-pylint python-pyflakes))))
|
'(python-pylint python-pyflakes))))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** Eshell
|
* pretty-control-l-mode
|
||||||
|
|
||||||
Add ~unison~ to the list of =eshell-visual-commands= because it
|
Make the ~C-l~ look like a line of ~-~ up to =fill-column= or
|
||||||
expects unbuffered input and eshell just doesn't give that.
|
=fci-rule-column= and remove the string displayed before the ~C-l~.
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp :tangle init2.el
|
#+BEGIN_SRC emacs-lisp :tangle init2.el
|
||||||
(eval-after-load "em-term"
|
(defun oni:pretty-control-l-function (win)
|
||||||
'(add-to-list 'eshell-visual-commands "unison"))
|
"Just make a string of either `fci-rule-column' or
|
||||||
#+END_SRC
|
`fill-column' length -1. Use the `-' character. WIN is ignored."
|
||||||
|
(make-string
|
||||||
|
(1- (if (boundp 'fci-rule-column)
|
||||||
|
fci-rule-column fill-column)) ?-))
|
||||||
|
|
||||||
Don't let eshell highlight it's prompt, this way I can decide the
|
(setq pp^L-^L-string-function 'oni:pretty-control-l-function)
|
||||||
colors for it myself.
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp :tangle init2.el
|
Remove the string displayed before the ~C-l~.
|
||||||
(setq eshell-highlight-prompt nil)
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
In the prompt:
|
#+BEGIN_SRC emacs-lisp :tangle init2.el
|
||||||
|
(setq pp^L-^L-string-pre nil)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
- Show the exit status of the last program/command run represented
|
Enable =pretty-control-l-mode= at startup and whenever a new frame is
|
||||||
by a green ~+~ and a red ~-~ sign.
|
created.
|
||||||
- Show the current hostname with the =mode-line-buffer-id= face.
|
|
||||||
- Show an abbreviation of the current directory (as seen in ~fish~)
|
|
||||||
using the =font-lock-string-face= face.
|
|
||||||
- If we're in a git repository, show the current branch with the
|
|
||||||
=font-lock-function-name-face= face.
|
|
||||||
- Show the status of priviledges in blue.
|
|
||||||
|
|
||||||
And set the =eshell-prompt-regexp= to
|
#+BEGIN_SRC emacs-lisp :tangle init2.el
|
||||||
|
(add-hook 'emacs-startup-hook 'pretty-control-l-mode)
|
||||||
|
(add-hook 'after-make-frame-functions
|
||||||
|
'(lambda (arg) (pretty-control-l-mode)))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp :tangle init2.el
|
* Eshell
|
||||||
(defun oni:eshell-prompt-function ()
|
|
||||||
"Show a pretty shell prompt."
|
|
||||||
(let ((status (if (zerop eshell-last-command-status) ?+ ?-))
|
|
||||||
(hostname (shell-command-to-string "hostname"))
|
|
||||||
(dir (abbreviate-file-name (eshell/pwd)))
|
|
||||||
(branch
|
|
||||||
(shell-command-to-string
|
|
||||||
"git branch --contains HEAD 2>/dev/null | sed -e '/^[^*]/d'"))
|
|
||||||
(userstatus (if (zerop (user-uid)) ?# ?$)))
|
|
||||||
(concat
|
|
||||||
(propertize (char-to-string status)
|
|
||||||
'face `(:foreground ,(if (= status ?+)
|
|
||||||
"green"
|
|
||||||
"red")))
|
|
||||||
" "
|
|
||||||
(propertize (substring hostname 0 -1) 'face 'mode-line-buffer-id)
|
|
||||||
" "
|
|
||||||
(propertize (oni:shorten-dir dir) 'face 'font-lock-string-face)
|
|
||||||
" "
|
|
||||||
(when (not (string= branch ""))
|
|
||||||
(propertize
|
|
||||||
;; Cut off "* " and "\n"
|
|
||||||
(substring branch 2 -1)
|
|
||||||
'face 'font-lock-function-name-face))
|
|
||||||
" \n"
|
|
||||||
(propertize (char-to-string userstatus)
|
|
||||||
'face `(:foreground "blue"))
|
|
||||||
"> ")))
|
|
||||||
|
|
||||||
(setq eshell-prompt-function 'oni:eshell-prompt-function
|
Add ~unison~ to the list of =eshell-visual-commands= because it
|
||||||
eshell-prompt-regexp "^[#$]> ")
|
expects unbuffered input and eshell just doesn't give that.
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
Don't truncate lines in eshell, wrap them.
|
#+BEGIN_SRC emacs-lisp :tangle init2.el
|
||||||
|
(eval-after-load "em-term"
|
||||||
|
'(add-to-list 'eshell-visual-commands "unison"))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp :tangle init2.el
|
Don't let eshell highlight it's prompt, this way I can decide the
|
||||||
(defun oni:eshell-mode-func ()
|
colors for it myself.
|
||||||
"Function for `eshell-mode-hook'."
|
|
||||||
(setq truncate-lines nil))
|
|
||||||
|
|
||||||
(add-hook 'eshell-mode-hook 'oni:eshell-mode-func)
|
#+BEGIN_SRC emacs-lisp :tangle init2.el
|
||||||
#+END_SRC
|
(setq eshell-highlight-prompt nil)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
Bind the ~f8~ key to easily show eshell.
|
In the prompt:
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp :tangle init2.el
|
- Show the exit status of the last program/command run represented
|
||||||
(defun oni:raise-eshell ()
|
by a green ~+~ and a red ~-~ sign.
|
||||||
"Start or switch back to `eshell'.
|
- Show the current hostname with the =mode-line-buffer-id= face.
|
||||||
Also change directories to current working directory."
|
- Show an abbreviation of the current directory (as seen in ~fish~)
|
||||||
(interactive)
|
using the =font-lock-string-face= face.
|
||||||
(let ((dir (file-name-directory
|
- If we're in a git repository, show the current branch with the
|
||||||
(or (buffer-file-name) "~/")))
|
=font-lock-function-name-face= face.
|
||||||
(hasfile (not (eq (buffer-file-name) nil))))
|
- Show the status of priviledges in blue.
|
||||||
(eshell)
|
|
||||||
(if (and hasfile (eq eshell-process-list nil))
|
|
||||||
(progn
|
|
||||||
(eshell/cd dir)
|
|
||||||
(eshell-reset)))))
|
|
||||||
|
|
||||||
(global-set-key (kbd "<f8>") 'oni:raise-eshell)
|
And set the =eshell-prompt-regexp= to
|
||||||
#+END_SRC
|
|
||||||
|
#+BEGIN_SRC emacs-lisp :tangle init2.el
|
||||||
|
(defun oni:eshell-prompt-function ()
|
||||||
|
"Show a pretty shell prompt."
|
||||||
|
(let ((status (if (zerop eshell-last-command-status) ?+ ?-))
|
||||||
|
(hostname (shell-command-to-string "hostname"))
|
||||||
|
(dir (abbreviate-file-name (eshell/pwd)))
|
||||||
|
(branch
|
||||||
|
(shell-command-to-string
|
||||||
|
"git branch --contains HEAD 2>/dev/null | sed -e '/^[^*]/d'"))
|
||||||
|
(userstatus (if (zerop (user-uid)) ?# ?$)))
|
||||||
|
(concat
|
||||||
|
(propertize (char-to-string status)
|
||||||
|
'face `(:foreground ,(if (= status ?+)
|
||||||
|
"green"
|
||||||
|
"red")))
|
||||||
|
" "
|
||||||
|
(propertize (substring hostname 0 -1) 'face 'mode-line-buffer-id)
|
||||||
|
" "
|
||||||
|
(propertize (oni:shorten-dir dir) 'face 'font-lock-string-face)
|
||||||
|
" "
|
||||||
|
(when (not (string= branch ""))
|
||||||
|
(propertize
|
||||||
|
;; Cut off "* " and "\n"
|
||||||
|
(substring branch 2 -1)
|
||||||
|
'face 'font-lock-function-name-face))
|
||||||
|
" \n"
|
||||||
|
(propertize (char-to-string userstatus)
|
||||||
|
'face `(:foreground "blue"))
|
||||||
|
"> ")))
|
||||||
|
|
||||||
|
(setq eshell-prompt-function 'oni:eshell-prompt-function
|
||||||
|
eshell-prompt-regexp "^[#$]> ")
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
Don't truncate lines in eshell, wrap them.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp :tangle init2.el
|
||||||
|
(defun oni:eshell-mode-func ()
|
||||||
|
"Function for `eshell-mode-hook'."
|
||||||
|
(setq truncate-lines nil))
|
||||||
|
|
||||||
|
(add-hook 'eshell-mode-hook 'oni:eshell-mode-func)
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
Bind the ~f8~ key to easily show eshell.
|
||||||
|
|
||||||
|
#+BEGIN_SRC emacs-lisp :tangle init2.el
|
||||||
|
(defun oni:raise-eshell ()
|
||||||
|
"Start or switch back to `eshell'.
|
||||||
|
Also change directories to current working directory."
|
||||||
|
(interactive)
|
||||||
|
(let ((dir (file-name-directory
|
||||||
|
(or (buffer-file-name) "~/")))
|
||||||
|
(hasfile (not (eq (buffer-file-name) nil))))
|
||||||
|
(eshell)
|
||||||
|
(if (and hasfile (eq eshell-process-list nil))
|
||||||
|
(progn
|
||||||
|
(eshell/cd dir)
|
||||||
|
(eshell-reset)))))
|
||||||
|
|
||||||
|
(global-set-key (kbd "<f8>") 'oni:raise-eshell)
|
||||||
|
#+END_SRC
|
||||||
|
|
|
@ -369,13 +369,6 @@ When dealing with braces, add another line and indent that too."
|
||||||
(setq-local fci-rule-column 80)
|
(setq-local fci-rule-column 80)
|
||||||
(flycheck-mode))
|
(flycheck-mode))
|
||||||
|
|
||||||
(defun oni:pretty-control-l-function (win)
|
|
||||||
"Just make a string of either `fci-rule-column' or
|
|
||||||
`fill-column' length -1. Use the `-' character. WIN is ignored."
|
|
||||||
(make-string
|
|
||||||
(1- (if (boundp 'fci-rule-column)
|
|
||||||
fci-rule-column fill-column)) ?-))
|
|
||||||
|
|
||||||
(defun oni:prog-mode-func ()
|
(defun oni:prog-mode-func ()
|
||||||
"Function for `prog-mode-hook'."
|
"Function for `prog-mode-hook'."
|
||||||
(rainbow-delimiters-mode)
|
(rainbow-delimiters-mode)
|
||||||
|
|
Loading…
Reference in a new issue