[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ELPA-diffs] /srv/bzr/emacs/elpa r159: * awp-mode: New package.
From: |
Stefan Monnier |
Subject: |
[ELPA-diffs] /srv/bzr/emacs/elpa r159: * awp-mode: New package. |
Date: |
Fri, 25 Nov 2011 09:51:22 -0500 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 159
committer: Stefan Monnier <address@hidden>
branch nick: elpa
timestamp: Fri 2011-11-25 09:51:22 -0500
message:
* awp-mode: New package.
added:
packages/awp-mode/
packages/awp-mode/awp-mode.el
=== added directory 'packages/awp-mode'
=== added file 'packages/awp-mode/awp-mode.el'
--- a/packages/awp-mode/awp-mode.el 1970-01-01 00:00:00 +0000
+++ b/packages/awp-mode/awp-mode.el 2011-11-25 14:51:22 +0000
@@ -0,0 +1,52 @@
+;;; awp-mode.el --- Perform smart line-wrapping with wrap-prefix
+
+;; Copyright (C) 2011 Stefan Monnier
+
+;; Author: Stephen Berman <address@hidden>
+;; Stefan Monnier <address@hidden>
+;; Version: 0.1
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(defun adaptive-wrap-prefix-function (beg end)
+ "Indent the region between BEG and END with adaptive filling."
+ (goto-char beg)
+ (while (< (point) end)
+ (let ((blp (line-beginning-position)))
+ (put-text-property (point)
+ (progn (search-forward "\n" end 'move) (point))
+ 'wrap-prefix
+ (fill-context-prefix blp (point))))))
+
+;;;###autoload
+(define-minor-mode adaptive-wrap-prefix-mode
+ "Wrap the buffer text with adaptive filling."
+ :lighter ""
+ (if adaptive-wrap-prefix-mode
+ (jit-lock-register #'adaptive-wrap-prefix-function)
+ (jit-lock-unregister #'adaptive-wrap-prefix-function)
+ (with-silent-modifications
+ (save-restriction
+ (widen)
+ (remove-text-properties (point-min) (point-max) '(wrap-prefix nil))))))
+
+
+(provide 'awp-mode)
+;;; awp-mode.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [ELPA-diffs] /srv/bzr/emacs/elpa r159: * awp-mode: New package.,
Stefan Monnier <=