aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.emacs38
-rw-r--r--.xkb/keymap/dpr7
2 files changed, 38 insertions, 7 deletions
diff --git a/.emacs b/.emacs
index f2488ea..222692c 100644
--- a/.emacs
+++ b/.emacs
@@ -129,3 +129,41 @@
(fset 'yes-or-no-p 'y-or-n-p)
(put 'narrow-to-region 'disabled nil)
+
+;; Sentence-fill hack
+;; ==================
+;;
+;; The macros here are based on emacs/23.3/lisp/textmodes/fill.el.gz.
+;; To use them without modifying emacs, you can simply execute `cat
+;; hack.el >> ~/.emacs` if you have downloaded this file (say, by
+;; git). Otherwise, you can use
+;;
+;; curl http://fermi.mycloudnas.com/cgit.cgi/fill/plain/hack.el >> ~/.emacs
+
+(defun auto-fill-by-sentences ()
+ (if (looking-back (sentence-end))
+ ;; Break at a sentence
+ (progn
+ (LaTeX-newline)
+ t)
+ ;; Fall back to the default
+ (do-auto-fill)))
+(add-hook 'LaTeX-mode-hook (lambda () (setq auto-fill-function 'auto-fill-by-sentences)))
+
+;; Modified from http://pleasefindattached.blogspot.com/2011/12/emacsauctex-sentence-fill-greatly.html
+(defadvice LaTeX-fill-region-as-paragraph (around LaTeX-sentence-filling)
+ "Start each sentence on a new line."
+ (let ((from (ad-get-arg 0))
+ (to-marker (set-marker (make-marker) (ad-get-arg 1)))
+ tmp-end)
+ (while (< from (marker-position to-marker))
+ (forward-sentence)
+ ;; might have gone beyond to-marker---use whichever is smaller:
+ (ad-set-arg 1 (setq tmp-end (min (point) (marker-position to-marker))))
+ ad-do-it
+ (ad-set-arg 0 (setq from (point)))
+ (unless (or (looking-back "^\\s *")
+ (looking-at "\\s *$"))
+ (LaTeX-newline)))
+ (set-marker to-marker nil)))
+(ad-activate 'LaTeX-fill-region-as-paragraph)
diff --git a/.xkb/keymap/dpr b/.xkb/keymap/dpr
deleted file mode 100644
index af75630..0000000
--- a/.xkb/keymap/dpr
+++ /dev/null
@@ -1,7 +0,0 @@
-xkb_keymap {
- xkb_keycodes { include "xfree86+aliases(qwerty)" };
- xkb_types { include "complete" };
- xkb_compat { include "complete" };
- xkb_symbols { include "pc+dpr+inet(pc105)+level3(ralt_switch_multikey)+ctrl(nocaps)+terminate(ctrl_alt_bksp)" };
- xkb_geometry { include "pc(pc105)" };
-};