From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: longlines-show-hard-newlines sets modified flag Date: Mon, 26 Nov 2007 18:24:39 +0100 Message-ID: <474B0157.2000800@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000701000200040705050601" X-Trace: ger.gmane.org 1196098104 17836 80.91.229.12 (26 Nov 2007 17:28:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 Nov 2007 17:28:24 +0000 (UTC) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 26 18:28:32 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Iwhl0-0005yK-Ol for ged-emacs-devel@m.gmane.org; Mon, 26 Nov 2007 18:28:31 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iwhkl-00030z-NH for ged-emacs-devel@m.gmane.org; Mon, 26 Nov 2007 12:28:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Iwhkb-0002uD-Mt for emacs-devel@gnu.org; Mon, 26 Nov 2007 12:28:05 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IwhkZ-0002sk-5a for emacs-devel@gnu.org; Mon, 26 Nov 2007 12:28:05 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IwhkZ-0002sc-0A for emacs-devel@gnu.org; Mon, 26 Nov 2007 12:28:03 -0500 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1IwhkY-0001aq-Ik for emacs-devel@gnu.org; Mon, 26 Nov 2007 12:28:02 -0500 Original-Received: (qmail invoked by alias); 26 Nov 2007 17:28:00 -0000 Original-Received: from N855P016.adsl.highway.telekom.at (EHLO [62.47.50.208]) [62.47.50.208] by mail.gmx.net (mp056) with SMTP; 26 Nov 2007 18:28:00 +0100 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX188nlQlfyg8LvPMOZw3iuOVbTYNvm7KK3lKC9FvAy /96eTz/kIF/zAX User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:84151 Archived-At: This is a multi-part message in MIME format. --------------000701000200040705050601 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit longlines.el has a bug you can reproduce with Emacs -Q as follows: (1) Visit an arbitrary file, for example, longlines.el (2) M-x longlines-mode (3) M-x longlines-show-hard-newlines The buffer is considered modified. The reason for this bug is bad handling of `buffer-modified-p' and `inhibit-modification-hooks' in the associated functions. The attached patch should cure this. If no one objects I'll install in a couple of days. --------------000701000200040705050601 Content-Type: text/plain; name="longlines.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="longlines.patch" *** longlines.el.~1.40.~ Fri Nov 2 09:54:54 2007 --- longlines.el Mon Nov 26 17:55:26 2007 *************** *** 207,239 **** "Make hard newlines visible by adding a face. With optional argument ARG, make the hard newlines invisible again." (interactive "P") - (let ((buffer-undo-list t) - (mod (buffer-modified-p))) (if arg (longlines-unshow-hard-newlines) (setq longlines-showing t) ! (longlines-show-region (point-min) (point-max))) ! (set-buffer-modified-p mod))) (defun longlines-show-region (beg end) "Make hard newlines between BEG and END visible." (let* ((pmin (min beg end)) (pmax (max beg end)) (pos (text-property-not-all pmin pmax 'hard nil)) ! (inhibit-read-only t)) (while pos (put-text-property pos (1+ pos) 'display ! (copy-sequence longlines-show-effect)) ! (setq pos (text-property-not-all (1+ pos) pmax 'hard nil))))) (defun longlines-unshow-hard-newlines () "Make hard newlines invisible again." (interactive) (setq longlines-showing nil) ! (let ((pos (text-property-not-all (point-min) (point-max) 'hard nil))) (while pos (remove-text-properties pos (1+ pos) '(display)) ! (setq pos (text-property-not-all (1+ pos) (point-max) 'hard nil))))) ;; Wrapping the paragraphs. --- 207,245 ---- "Make hard newlines visible by adding a face. With optional argument ARG, make the hard newlines invisible again." (interactive "P") (if arg (longlines-unshow-hard-newlines) (setq longlines-showing t) ! (longlines-show-region (point-min) (point-max)))) (defun longlines-show-region (beg end) "Make hard newlines between BEG and END visible." (let* ((pmin (min beg end)) (pmax (max beg end)) (pos (text-property-not-all pmin pmax 'hard nil)) ! (mod (buffer-modified-p)) ! (buffer-undo-list t) ! (inhibit-read-only t) ! (inhibit-modification-hooks t)) (while pos (put-text-property pos (1+ pos) 'display ! (copy-sequence longlines-show-effect)) ! (setq pos (text-property-not-all (1+ pos) pmax 'hard nil))) ! (set-buffer-modified-p mod))) (defun longlines-unshow-hard-newlines () "Make hard newlines invisible again." (interactive) (setq longlines-showing nil) ! (let ((pos (text-property-not-all (point-min) (point-max) 'hard nil)) ! (mod (buffer-modified-p)) ! (buffer-undo-list t) ! (inhibit-read-only t) ! (inhibit-modification-hooks t)) (while pos (remove-text-properties pos (1+ pos) '(display)) ! (setq pos (text-property-not-all (1+ pos) (point-max) 'hard nil))) ! (set-buffer-modified-p mod))) ;; Wrapping the paragraphs. --------------000701000200040705050601 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --------------000701000200040705050601--