;;; -*- lexical-binding: t -*- ;;; ;;; this file: ;;; http://user.it.uu.se/~embe8573/emacs-init/fill-new.el ;;; https://dataswamp.org/~incal/emacs-init/fill-new.el (setq fill-nobreak-predicate '(fill-single-char-nobreak-p fill-single-word-nobreak-p) ) (require 'message) (let ((fill-col 62)) (setq fill-column fill-col) (setq-default fill-column fill-col) (setq message-fill-column fill-col) ) (setq sentence-end-double-space nil) (defun fill-down (start end &optional justify) "Fill the current paragraph from the current line down.\n With mark active, act upon the region instead.\n With \\[universal-argument], remove full justification." (interactive (if (use-region-p) (list (region-beginning) (region-end) current-prefix-arg) (list (line-beginning-position) (save-excursion (forward-paragraph) (point)) current-prefix-arg))) (if (equal justify '(4)) ; C-u -> unjustify (canonically-space-region start end) (fill-region start end) )) ; no C-u -> fill (defun unfill-region (beg end) "Unfill the region, joining text paragraphs into a single line. http://emacswiki.org/emacs/unfillregion" (interactive "*r") (let ((fill-column (point-max))) (fill-region beg end) )) ;; buffer (defun fill-buffer () "Fill all paragraphs in the buffer." (interactive) (fill-region (point-min) (point-max)) ) (defun unfill-buffer () "Unfill all paragraphs in the buffer." (interactive) (unfill-region (point-min) (point-max)) ) (provide 'fill-new)