X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/5d0aebc837246c3c87d02a980895943f8ce12420..6517ec8921438deae6547ab5eb38e004935d5618:/packages/adaptive-wrap/adaptive-wrap.el diff --git a/packages/adaptive-wrap/adaptive-wrap.el b/packages/adaptive-wrap/adaptive-wrap.el index 1b3ff941f..9455789d6 100644 --- a/packages/adaptive-wrap/adaptive-wrap.el +++ b/packages/adaptive-wrap/adaptive-wrap.el @@ -1,10 +1,10 @@ ;;; adaptive-wrap.el --- Smart line-wrapping with wrap-prefix -;; Copyright (C) 2011, 2012 Free Software Foundation, Inc. +;; Copyright (C) 2011-2013 Free Software Foundation, Inc. ;; Author: Stephen Berman ;; Stefan Monnier -;; Version: 0.2 +;; Version: 0.5 ;; 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 @@ -28,6 +28,8 @@ ;;; Code: +(require 'easymenu) + (defcustom adaptive-wrap-extra-indent 0 "Number of extra spaces to indent in `adaptive-wrap-prefix-mode'. @@ -94,12 +96,26 @@ extra indent = 2 :lighter "" :group 'visual-line (if adaptive-wrap-prefix-mode - (jit-lock-register #'adaptive-wrap-prefix-function) + (progn + ;; HACK ATTACK! We need to run after font-lock, but jit-lock-register + ;; doesn't accept an `append' argument, so we add ourselves beforehand, + ;; to make sure we're at the end of the hook (bug#15155). + (add-hook 'jit-lock-functions + #'adaptive-wrap-prefix-function 'append t) + (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)))))) +(define-key-after (lookup-key menu-bar-options-menu [line-wrapping]) + [adaptive-wrap] + '(menu-item "Adaptive Wrap" adaptive-wrap-prefix-mode + :visible (menu-bar-menu-frame-live-and-visible-p) + :help "Show wrapped long lines with an adjustable prefix" + :button (:toggle . (bound-and-true-p adaptive-wrap-prefix-mode))) + word-wrap) + (provide 'adaptive-wrap) ;;; adaptive-wrap.el ends here