X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=emacs.el;h=6d4ffe8cad3efe1ec8ebd8abe04975e600e9881a;hb=41d67536a6418bc1b6259cc3f390b892cb931417;hp=0a8ca7dae69d8fdcdef894a2920f0f02267e5973;hpb=6416868628cb18f5a55d685c464ab99b54e0077f;p=elisp.git diff --git a/emacs.el b/emacs.el index 0a8ca7d..6d4ffe8 100644 --- a/emacs.el +++ b/emacs.el @@ -34,9 +34,9 @@ ;; (set-default-font "Bitstream vera sans mono-12") ;; (set-default-font "Liberation Mono-13") (set-default-font "Inconsolata 15") -;;(set-default-font "DejaVu sans mono 11") -;;(set-default-font "Droid sans mono 13") -;;(set-default-font "Opensans 10") +;; (set-default-font "DejaVu sans mono 11") +;; (set-default-font "Droid sans mono 13") +;; (set-default-font "Opensans 10") (when (fboundp 'horizontal-scroll-bar-mode) (horizontal-scroll-bar-mode -1)) @@ -90,7 +90,8 @@ ) ;; Activate the dynamic completion of buffer names -(iswitchb-mode 1) +;; (iswitchb-mode 1) +;; (load "lcomplete") ;; Save the minibuffer history (setq savehist-file (concat ff/emacs-dir "/savehist")) @@ -327,6 +328,8 @@ load-warning buffer in case of failure." ;; What modes for what file extentions (add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode)) +(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) + (require 'org-table) (add-to-list 'auto-mode-alist '("\\.txt\\'" . (lambda() @@ -581,6 +584,16 @@ load-warning buffer in case of failure." (define-key global-map [(meta up)] 'ff/scroll-down) (define-key global-map [(meta down)] 'ff/scroll-up) + +(define-key global-map [(meta shift up)] + (lambda () (interactive) (condition-case nil (scroll-down 10) (error nil)))) + +(define-key global-map [(meta shift down)] + (lambda () (interactive) (condition-case nil (scroll-up 10) (error nil)))) + +;; (define-key global-map [(meta shift up)] (lambda () (interactive) (ff/scroll-down 10))) +;; (define-key global-map [(meta shift down)] 'ff/scroll-up) + (define-key global-map [(meta p)] 'ff/scroll-down) (define-key global-map [(meta n)] 'ff/scroll-up) (define-key global-map [(meta right)] 'ff/scroll-left) @@ -840,16 +853,20 @@ printer." ) 'unknown)) -(defun ff/sum-numbers (list-files prefix) +(defun ff/sum-values-from-files (list-files prefix) (apply '+ (mapcar - (lambda (f) (string-to-number (ff/file-first-line (format "%s/%s" f prefix)))) + (lambda (f) + (condition-case nil + (string-to-number (ff/file-first-line (format "%s/%s" f prefix))) + (error 0)) + ) list-files))) (defun ff/battery-percent () (condition-case nil - (/ (* 100 (ff/sum-numbers ff/battery-dirs "energy_now")) - (ff/sum-numbers ff/battery-dirs "energy_full")) + (/ (* 100 (ff/sum-values-from-files ff/battery-dirs "energy_now")) + (ff/sum-values-from-files ff/battery-dirs "energy_full")) (error -1)) ) @@ -864,22 +881,23 @@ printer." (lambda (f) (string-to-number (ff/file-first-line f))) ff/temperature-files)) 1000))) + (if (> temp 50) - (concat - (let ((s (format "%dC " temp))) - (if (> temp 70) (propertize s 'face - 'font-lock-warning-face) - s)) - ) + (let ((s (format "%dC " temp))) + (if (> temp 70) + (propertize s 'face 'font-lock-warning-face) + s) + ) ) ) ;; The battery (pcase (ff/battery-state ff/battery-dirs) - (`charging (format "L%d%%" (ff/battery-percent))) - (`discharging (format "B%d%%" (ff/battery-percent))) - (code "L")) + (`charging (format "c%d%%" (ff/battery-percent))) + (`discharging (format "d%d%%" (ff/battery-percent))) + (`unknown "f") + (_ "?")) ) @@ -914,7 +932,7 @@ printer." ) '( - ("hostname" nil t nil "-v") + ("hostname" nil t nil "-f") ("acpi" nil t) ("df" nil t nil "-h") ;; ("mount" nil t) @@ -965,6 +983,9 @@ printer." ;; " ") ;; ) + ,(if (ff/temp-and-battery-info-string) + '(concat (ff/temp-and-battery-info-string) " ")) + (propertize (concat 24-hours ":" minutes " " dayname " " @@ -974,9 +995,6 @@ printer." load - ,(if (ff/temp-and-battery-info-string) - '(concat " " (ff/temp-and-battery-info-string))) - ) ;; display-time-format "%b %a %e %H:%M" @@ -1010,10 +1028,13 @@ printer." (setq list (cdr list))) (switch-to-buffer found))) -(define-key global-map [?\C-x right] 'ff/next-buffer) -(define-key global-map [?\C-x left] 'ff/prev-buffer) -(define-key global-map [?\C-'] 'ff/next-buffer) -(define-key global-map [?\C-\;] 'ff/prev-buffer) +;; (define-key global-map [?\C-x right] 'ff/next-buffer) +;; (define-key global-map [?\C-x left] 'ff/prev-buffer) +;; (define-key global-map [?\M-\]] 'ff/next-buffer) +;; (define-key global-map [?\M-\[] 'ff/prev-buffer) + +(define-key global-map [(meta right)] 'ff/next-buffer) +(define-key global-map [(meta left)] 'ff/prev-buffer) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; There is actually a decent terminal emulator in emacs! @@ -1459,9 +1480,9 @@ universal argument starts xfig even if the .fig does not exist" (let ((start (condition-case nil (region-beginning) (error (point)))) (end (condition-case nil (region-end) (error (point))))) (goto-char end) - (insert "---------------------------- snip snip -------------------------------\n") + (insert "----------------------------- snip snip -----------------------------\n") (goto-char start) - (insert "---------------------------- snip snip -------------------------------\n") + (insert "----------------------------- snip snip -----------------------------\n") )) (defun ff/start-latex () @@ -1470,7 +1491,7 @@ universal argument starts xfig even if the .fig does not exist" (goto-char (point-min)) (insert "%% -*- mode: latex; mode: reftex; mode: flyspell; coding: utf-8; tex-command: \"pdflatex.sh\" -*- -\\documentclass[12pt]{article} +\\documentclass[12pt,a4paper,twoside]{article} \\usepackage[a4paper,top=2.5cm,bottom=2cm,left=2.5cm,right=2.5cm]{geometry} \\usepackage[utf8]{inputenc} \\usepackage{amsmath} @@ -1692,7 +1713,7 @@ int main(int argc, char **argv) {