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

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

Automaticly adding a new line in find-file-literally


From: Ehud Karni
Subject: Automaticly adding a new line in find-file-literally
Date: Mon, 13 Nov 2000 11:57:28 +0200

The problem: if `require-final-newline' is set to t, and a file
visited in literal mode (by find-file-literally) is saved then
a new line (\n) may be added silently. If the `require-final-newline'
is set to 'ask then a question is popped up.

I think this is a bug, and `require-final-newline' should be ignored
when visiting file literally.

I suggest the following patch to files.el:

diff -c /usr/local/share/emacs/20.7/lisp/files.el ~/files.el
*** /usr/local/share/emacs/20.7/lisp/files.el   Tue May 23 14:17:39 2000
--- ~/files.el          Mon Nov 13 09:46:35 2000
***************
*** 2359,2364 ****
--- 2359,2365 ----
            (widen)
            (save-excursion
              (and (> (point-max) 1)
+                  (not find-file-literally)        ;; no adding if "literally"
                   (/= (char-after (1- (point-max))) ?\n)
                   (not (and (eq selective-display t)
                             (= (char-after (1- (point-max))) ?\r)))

Diff finished at Mon Nov 13 09:50:34

BTW. Why is (not (null foo)) safer than `foo' itself ? It seems that
     this double negative construct (`not' is an alias for `null') is
     used several times in files.el within `and' and `or'.

Ehud.


-- 
 @@@@@@ @@@ @@@@@@ @    @   Ehud Karni  Simon & Wiesel  Insurance agency
     @    @      @  @@  @   Tel: +972-3-6212-757    Fax: +972-3-6292-544
     @    @ @    @ @  @@    (USA)  Fax  and  voice  mail:  1-815-5509341
     @    @ @    @ @    @        Better     Safe     Than     Sorry
 http://www.simonwiesel.co.il    mailto:address@hidden



reply via email to

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