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

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

Respect buffer narrowing in Forms mode (correction)


From: Thomas Morgan
Subject: Respect buffer narrowing in Forms mode (correction)
Date: 26 Apr 2001 15:14:51 -0400
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

This is a correction to my previous message.  This new diff is
followed by my original explanation.

*** /usr/share/emacs/20.7/lisp/forms.el.orig    Mon May 31 04:34:29 1999
--- /usr/share/emacs/20.7/lisp/forms.el Thu Apr 26 14:49:09 2001
***************
*** 1700,1706 ****
           (if (zerop disp)
               nil
             (setq cur (+ cur disp (- (forward-line disp)))))
!        (setq cur (+ cur disp (- (goto-line arg)))))
  
         (forms--get-record)))
  
--- 1700,1707 ----
           (if (zerop disp)
               nil
             (setq cur (+ cur disp (- (forward-line disp)))))
!        (goto-char (point-min))
!        (setq cur (+ cur disp (- (forward-line (1- arg))))))
  
         (forms--get-record)))
  
***************
*** 1810,1816 ****
  
      (save-excursion
        (set-buffer forms--file-buffer)
!       (goto-line ln)
        (open-line 1)
        (insert the-record)
        (beginning-of-line))
--- 1811,1818 ----
  
      (save-excursion
        (set-buffer forms--file-buffer)
!       (goto-char (point-min))
!       (forward-line (1- ln))
        (open-line 1)
        (insert the-record)
        (beginning-of-line))
***************
*** 1833,1839 ****
        (let ((ln forms--current-record))
        (save-excursion
          (set-buffer forms--file-buffer)
!         (goto-line ln)
          ;; Use delete-region instead of kill-region, to avoid
          ;; adding junk to the kill-ring.
          (delete-region (progn (beginning-of-line) (point))
--- 1835,1842 ----
        (let ((ln forms--current-record))
        (save-excursion
          (set-buffer forms--file-buffer)
!         (goto-char (point-min))
!         (forward-line (1- ln))
          ;; Use delete-region instead of kill-region, to avoid
          ;; adding junk to the kill-ring.
          (delete-region (progn (beginning-of-line) (point))

Diff finished at Thu Apr 26 15:12:18

GNU Emacs 20.7.2 (i686-pc-linux-gnu, X toolkit) of Fri Mar 16 2001 on zamenhof

I have a data file for Forms mode which contains other information
before and after the data, so I wrote the forms-read-file-filter
function to narrow the buffer and the forms-write-file-filter function
to widen it.

It turned out that Forms mode is not prepared for narrowed buffers.
In the mode line the correct total number of records is shown, but
Emacs will never reach those records at the end.  This is because it
moves to a given line number relative to the beginning of the file,
not relative to beginning of the narrowed portion.



reply via email to

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