emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with longlines-mode


From: Chong Yidong
Subject: Re: Problems with longlines-mode
Date: Mon, 22 Aug 2005 17:15:35 -0400 (EDT)
User-agent: SquirrelMail/1.4.4

> The minor mode longlines-mode has several problems. First, turning it
> on and off again does not turn into a no-op as it should... [snip]
> Secondly, it does not work if the buffer is read-only.

It is not possible to make turning on and off longlines-mode a perfect
no-op.  However, the following patch removes the specific annoyances
reported in the email.  It also makes longlines-mode work for read-only
buffers.  Thanks for the bug report.

Could someone with CVS write access check this in?

*** emacs/lisp/longlines.el~    2005-08-23 04:40:49.000000000 +0800
--- emacs/lisp/longlines.el     2005-08-23 05:15:23.000000000 +0800
***************
*** 116,121 ****
--- 116,122 ----
            (add-hook 'window-configuration-change-hook
                      'longlines-window-change-function nil t))
          (let ((buffer-undo-list t)
+               (buffer-read-only nil)
                (mod (buffer-modified-p)))
            ;; Turning off undo is OK since (spaces + newlines) is
            ;; conserved, except for a corner case in
***************
*** 136,142 ****
      (setq buffer-file-format (delete 'longlines buffer-file-format))
      (if longlines-showing
          (longlines-unshow-hard-newlines))
!     (let ((buffer-undo-list t))
        (longlines-encode-region (point-min) (point-max)))
      (remove-hook 'change-major-mode-hook 'longlines-mode-off t)
      (remove-hook 'before-kill-functions 'longlines-encode-region t)
--- 137,144 ----
      (setq buffer-file-format (delete 'longlines buffer-file-format))
      (if longlines-showing
          (longlines-unshow-hard-newlines))
!     (let ((buffer-undo-list t)
!           (buffer-read-only nil))
        (longlines-encode-region (point-min) (point-max)))
      (remove-hook 'change-major-mode-hook 'longlines-mode-off t)
      (remove-hook 'before-kill-functions 'longlines-encode-region t)
***************
*** 144,150 ****
      (remove-hook 'post-command-hook 'longlines-post-command-function t)
      (remove-hook 'window-configuration-change-hook
                   'longlines-window-change-function t)
!     (kill-local-variable 'fill-column)))

  (defun longlines-mode-off ()
    "Turn off longlines mode.
--- 146,156 ----
      (remove-hook 'post-command-hook 'longlines-post-command-function t)
      (remove-hook 'window-configuration-change-hook
                   'longlines-window-change-function t)
!     (when longlines-wrap-follows-window-size
!       (kill-local-variable 'fill-column))
!     (kill-local-variable 'require-final-newline)
!     (kill-local-variable 'buffer-substring-filters)
!     (kill-local-variable 'use-hard-newlines)))

  (defun longlines-mode-off ()
    "Turn off longlines mode.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]