From unknown Sun Aug 17 01:42:07 2025 X-Loop: don@donarmstrong.com Subject: bug#1039: 23.0.60; emacs forgets EOL convention after revert-buffer Reply-To: pdewacht@gmail.com (Peter De Wachter), 1039@debbugs.gnu.org Resent-From: pdewacht@gmail.com (Peter De Wachter) Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Sat, 27 Sep 2008 21:25:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1039 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by submit@emacsbugs.donarmstrong.com id=B.122255016711197 (code B ref -1); Sat, 27 Sep 2008 21:25:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.4 required=4.0 tests=AWL,BAYES_00,FOURLA, RCVD_IN_DNSWL_MED autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 27 Sep 2008 21:16:07 +0000 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8RLG3lG011191 for ; Sat, 27 Sep 2008 14:16:04 -0700 Received: from mail.gnu.org ([199.232.76.166]:54810 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1Kjh6v-0002AC-Lu for emacs-pretest-bug@gnu.org; Sat, 27 Sep 2008 17:13:53 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Kjh8y-0001CA-3r for emacs-pretest-bug@gnu.org; Sat, 27 Sep 2008 17:16:02 -0400 Received: from lmailproxy01.edpnet.net ([212.71.1.194]:47954) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kjh8x-0001Be-I0 for emacs-pretest-bug@gnu.org; Sat, 27 Sep 2008 17:15:59 -0400 Received: from tleilaxu (213.219.169.105.adsl.dyn.edpnet.net [213.219.169.105]) by lmailproxy01.edpnet.net (8.13.1/8.13.1) with ESMTP id m8RLFmoa017032; Sat, 27 Sep 2008 23:15:49 +0200 Received: by tleilaxu (Postfix, from userid 1000) id AF7DC1628122; Sat, 27 Sep 2008 23:15:48 +0200 (CEST) To: emacs-pretest-bug@gnu.org CC: rfrancoise@debian.org Message-Id: <20080927211548.AF7DC1628122@tleilaxu> Date: Sat, 27 Sep 2008 23:15:48 +0200 (CEST) From: pdewacht@gmail.com (Peter De Wachter) X-Virus-Scanned: ClamAV 0.94/8345/Sat Sep 27 03:20:01 2008 on lmailproxy01.edpnet.net X-Virus-Status: Clean X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) If you load a file with DOS line endings, and revert it with M-x revert-buffer, emacs forgets the used EOL convention and will use Unix line endings when writing the file. In GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, GTK+ Version 2.12.11) of 2008-09-19 on elegiac, modified by Debian (emacs-snapshot package, version 1:20080919-1) configured using `configure '--build' 'x86_64-linux-gnu' '--host' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/23.0.60/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.0.60/site-lisp:/usr/share/emacs/site-lisp' '--with-x=yes' '--with-x-toolkit=gtk' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: nl_BE.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default-enable-multibyte-characters: t Major mode: Fundamental Minor modes in effect: tooltip-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: C-x C-f f o o RET ESC x r e v e r t RET y e s RET ESC x r e p o r t - b u g TAB RET Recent messages: ("emacs-snapshot" "-Q") For information about GNU Emacs and the GNU system, type C-h C-a. From unknown Sun Aug 17 01:42:07 2025 X-Loop: don@donarmstrong.com Subject: bug#1039: 23.0.60; emacs forgets EOL convention after revert-buffer Reply-To: martin rudalics , 1039@debbugs.gnu.org Resent-From: martin rudalics Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Sat, 27 Sep 2008 22:25:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1039 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by 1039-submit@emacsbugs.donarmstrong.com id=B1039.122255378126112 (code B ref 1039); Sat, 27 Sep 2008 22:25:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-5.4 required=4.0 tests=AWL,BAYES_00,FVGT_m_MULTI_ODD, HAS_BUG_NUMBER,MIXEDBDN,MURPHY_DRUGS_REL8,PHONENUMBER autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 1039) by emacsbugs.donarmstrong.com; 27 Sep 2008 22:16:21 +0000 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id m8RMGG29026105 for <1039@emacsbugs.donarmstrong.com>; Sat, 27 Sep 2008 15:16:17 -0700 Received: (qmail invoked by alias); 27 Sep 2008 22:16:10 -0000 Received: from 62-47-47-119.adsl.highway.telekom.at (EHLO [62.47.47.119]) [62.47.47.119] by mail.gmx.net (mp054) with SMTP; 28 Sep 2008 00:16:10 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX181MRRiEeg1+YAw3a9/FGodbQlbTVb/1K5EDkErQg cNoI35cMNrq+Le Message-ID: <48DEAFBE.1080806@gmx.at> Date: Sun, 28 Sep 2008 00:12:14 +0200 From: martin rudalics User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Peter De Wachter , 1039@debbugs.gnu.org CC: rfrancoise@debian.org References: <20080927211548.AF7DC1628122@tleilaxu> In-Reply-To: <20080927211548.AF7DC1628122@tleilaxu> Content-Type: multipart/mixed; boundary="------------040406090001010100080608" X-Y-GMX-Trusted: 0 X-FuHaFi: 0.78,0.5600000000000001 This is a multi-part message in MIME format. --------------040406090001010100080608 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > If you load a file with DOS line endings, and revert it with M-x > revert-buffer, emacs forgets the used EOL convention and will use > Unix line endings when writing the file. The inverse scenario of this is biting me for some time already. I'm currently using the attached patch. martin --------------040406090001010100080608 Content-Type: text/plain; name="revert.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="revert.diff" *** files.el.~1.999.~ 2008-09-22 07:39:31.937500000 +0200 --- files.el 2008-09-26 13:49:18.968750000 +0200 *************** *** 4437,4442 **** --- 4437,4443 ---- mechanism, this hook is not used.") (defvar revert-buffer-internal-hook) + (defvar revert-buffer-file-coding-system) (defun revert-buffer (&optional ignore-auto noconfirm preserve-modes) "Replace current buffer text with the text of the visited file on disk. *************** *** 4558,4571 **** ;; (called from insert-file-contents) to set ;; buffer-file-coding-system to a proper value. (kill-local-variable 'buffer-file-coding-system) ! ;; Note that this preserves point in an intelligent way. (if preserve-modes (let ((buffer-file-format buffer-file-format)) (insert-file-contents file-name (not auto-save-p) nil nil t)) (insert-file-contents file-name (not auto-save-p) ! nil nil t))))) ;; Recompute the truename in case changes in symlinks ;; have changed the truename. (setq buffer-file-truename --- 4559,4578 ---- ;; (called from insert-file-contents) to set ;; buffer-file-coding-system to a proper value. (kill-local-variable 'buffer-file-coding-system) ! ;; But in case something goes wrong there provide a ! ;; fallback coding system. ! (setq revert-buffer-file-coding-system ! (list revert-buffer-file-coding-system)) ;; Note that this preserves point in an intelligent way. (if preserve-modes (let ((buffer-file-format buffer-file-format)) (insert-file-contents file-name (not auto-save-p) nil nil t)) (insert-file-contents file-name (not auto-save-p) ! nil nil t)) ! ;; Remember this. ! (setq revert-buffer-file-coding-system ! buffer-file-coding-system)))) ;; Recompute the truename in case changes in symlinks ;; have changed the truename. (setq buffer-file-truename *** international/mule.el.~1.274.~ 2008-07-31 07:33:47.000000000 +0200 --- international/mule.el 2008-09-26 13:55:52.640625000 +0200 *************** *** 1146,1151 **** --- 1146,1163 ---- (put (intern name) 'coding-system-define-form form) (setq coding-system-alist (cons (list name) coding-system-alist))))) + ;;; This is nil initially, set to `buffer-file-coding-system' when the + ;;; latter is set, and to a list with that value as its only element + ;;; when the buffer shall be reverted. `after-insert-file-set-coding' + ;;; will use this value when `find-new-buffer-file-coding-system' does + ;;; not provide a useful value. + (defvar revert-buffer-file-coding-system nil + "The file coding system usable for reverting a buffer. + Internally used by when reverting a buffer and no other coding + system is provided.") + (make-variable-buffer-local 'revert-buffer-file-coding-system) + (put 'revert-buffer-file-coding-system 'permanent-local t) + (defun set-buffer-file-coding-system (coding-system &optional force nomodify) "Set the file coding-system of the current buffer to CODING-SYSTEM. This means that when you save the buffer, it will be converted *************** *** 1169,1174 **** --- 1181,1188 ---- (setq coding-system (merge-coding-systems coding-system buffer-file-coding-system))) (setq buffer-file-coding-system coding-system) + ;; And record its value here. + (setq revert-buffer-file-coding-system coding-system) ;; This is in case of an explicit call. Normally, `normal-mode' and ;; `set-buffer-major-mode-hook' take care of setting the table. (if (fboundp 'ucs-set-table-for-input) ; don't lose when building *************** *** 1860,1866 **** (setq buffer-file-coding-system-explicit coding-system-for-read)) (if last-coding-system-used (let ((coding-system ! (find-new-buffer-file-coding-system last-coding-system-used))) (when coding-system ;; Tell set-buffer-file-coding-system not to mark the file ;; as modified; we just read it, and it's supposed to be unmodified. --- 1874,1883 ---- (setq buffer-file-coding-system-explicit coding-system-for-read)) (if last-coding-system-used (let ((coding-system ! (or (find-new-buffer-file-coding-system last-coding-system-used) ! ;; Use the coding system before revertin the buffer if ! ;; we have nothing newer. ! (car-safe revert-buffer-file-coding-system)))) (when coding-system ;; Tell set-buffer-file-coding-system not to mark the file ;; as modified; we just read it, and it's supposed to be unmodified. --------------040406090001010100080608-- From unknown Sun Aug 17 01:42:07 2025 X-Loop: don@donarmstrong.com Subject: bug#1039: 23.0.60; emacs forgets EOL convention after revert-buffer Reply-To: Chong Yidong , 1039@debbugs.gnu.org Resent-From: Chong Yidong Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Wed, 08 Oct 2008 16:20:02 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1039 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: patch Received: via spool by 1039-submit@emacsbugs.donarmstrong.com id=B1039.122348243013704 (code B ref 1039); Wed, 08 Oct 2008 16:20:02 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-5.4 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 1039) by emacsbugs.donarmstrong.com; 8 Oct 2008 16:13:50 +0000 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m98GDfeJ013697 for <1039@emacsbugs.donarmstrong.com>; Wed, 8 Oct 2008 09:13:42 -0700 Received: by cyd.mit.edu (Postfix, from userid 1000) id F2F8857E212; Wed, 8 Oct 2008 12:15:22 -0400 (EDT) From: Chong Yidong To: martin rudalics Cc: 1039@debbugs.gnu.org Date: Wed, 08 Oct 2008 12:15:22 -0400 Message-ID: <87iqs3oyg5.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > The inverse scenario of this is biting me for some time already. I'm > currently using the attached patch. I don't understand the need for the revert-buffer-file-coding-system variable. Why doesn't last-coding-system-used work here? From unknown Sun Aug 17 01:42:07 2025 X-Loop: don@donarmstrong.com Subject: bug#1039: 23.0.60; emacs forgets EOL convention after revert-buffer Reply-To: martin rudalics , 1039@debbugs.gnu.org Resent-From: martin rudalics Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Wed, 08 Oct 2008 18:10:04 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1039 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: patch Received: via spool by 1039-submit@emacsbugs.donarmstrong.com id=B1039.12234890918504 (code B ref 1039); Wed, 08 Oct 2008 18:10:04 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-6.6 required=4.0 tests=AWL,BAYES_00,FOURLA, HAS_BUG_NUMBER,MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 1039) by emacsbugs.donarmstrong.com; 8 Oct 2008 18:04:51 +0000 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id m98I4hdc008495 for <1039@emacsbugs.donarmstrong.com>; Wed, 8 Oct 2008 11:04:45 -0700 Received: (qmail invoked by alias); 08 Oct 2008 18:04:37 -0000 Received: from 62-47-54-129.adsl.highway.telekom.at (EHLO [62.47.54.129]) [62.47.54.129] by mail.gmx.net (mp015) with SMTP; 08 Oct 2008 20:04:37 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18+y3IeWCc+8zuaWL5Wa5lkN4sGsf04h4OuqIa3CU 7peHRT3ZqGXRUR Message-ID: <48ECF5DD.7020104@gmx.at> Date: Wed, 08 Oct 2008 20:03:09 +0200 From: martin rudalics User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Chong Yidong CC: 1039@debbugs.gnu.org, Peter De Wachter References: <87iqs3oyg5.fsf@cyd.mit.edu> In-Reply-To: <87iqs3oyg5.fsf@cyd.mit.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.75 > I don't understand the need for the revert-buffer-file-coding-system > variable. Why doesn't last-coding-system-used work here? I suppose it's because of the intelligent point preserving behavior of `revert-buffer'. When buffer and file don't differ (modulo decoding) nothing gets inserted. OTOH Handa kills `buffer-file-coding-system' in `revert-buffer' since 2002 so the old value is lost and Emacs goes for the default value instead. I don't understand though why the problem became virulent only lately. In any case it would be helpful if the OP tested whether my patch works for him ;-) martin From unknown Sun Aug 17 01:42:07 2025 X-Loop: don@donarmstrong.com Subject: bug#1039: 23.0.60; emacs forgets EOL convention after revert-buffer Reply-To: Peter De Wachter , 1039@debbugs.gnu.org Resent-From: Peter De Wachter Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Sat, 11 Oct 2008 22:20:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1039 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: patch Received: via spool by 1039-submit@emacsbugs.donarmstrong.com id=B1039.122376305725761 (code B ref 1039); Sat, 11 Oct 2008 22:20:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-5.2 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 1039) by emacsbugs.donarmstrong.com; 11 Oct 2008 22:10:57 +0000 Received: from lmailproxy01.edpnet.net (lmailproxy01.edpnet.net [212.71.1.194]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9BMArL6025748 for <1039@emacsbugs.donarmstrong.com>; Sat, 11 Oct 2008 15:10:55 -0700 Received: from tleilaxu (213.219.137.163.adsl.dyn.edpnet.net [213.219.137.163]) by lmailproxy01.edpnet.net (8.13.1/8.13.1) with ESMTP id m9BMAh3J014874; Sun, 12 Oct 2008 00:10:44 +0200 Received: from tleilaxu (localhost.localdomain [127.0.0.1]) by tleilaxu (Postfix) with ESMTP id 39BC61628208; Sun, 12 Oct 2008 00:10:43 +0200 (CEST) Date: Sun, 12 Oct 2008 00:10:41 +0200 From: Peter De Wachter To: martin rudalics Cc: Chong Yidong , 1039@debbugs.gnu.org Message-ID: <20081012001041.116d71e5@tleilaxu> In-Reply-To: <48ECF5DD.7020104@gmx.at> References: <87iqs3oyg5.fsf@cyd.mit.edu> <48ECF5DD.7020104@gmx.at> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV version 0.94, clamav-milter version 0.94 on lmailproxy01.edpnet.net X-Virus-Status: Clean On Wed, 08 Oct 2008 20:03:09 +0200 martin rudalics wrote: > In any case it would be helpful if the OP tested whether my patch > works for him ;-) That patch fixes the bug I reported, but it creates a new one: if you change the EOL convention outside of emacs, revert-buffer no longer detects this. To reproduce: printf "hello\r\nworld\r\n" > hello emacs -Q hello & printf "hello\rworld\r" > hello M-x revert-buffer # emacs still sees DOS newlines -- Peter De Wachter From unknown Sun Aug 17 01:42:07 2025 X-Loop: don@donarmstrong.com Subject: bug#1039: 23.0.60; emacs forgets EOL convention after revert-buffer Reply-To: martin rudalics , 1039@debbugs.gnu.org Resent-From: martin rudalics Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Sun, 12 Oct 2008 19:00:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1039 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: patch Received: via spool by 1039-submit@emacsbugs.donarmstrong.com id=B1039.122383746512248 (code B ref 1039); Sun, 12 Oct 2008 19:00:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-6.7 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 1039) by emacsbugs.donarmstrong.com; 12 Oct 2008 18:51:05 +0000 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id m9CIp0R6012240 for <1039@emacsbugs.donarmstrong.com>; Sun, 12 Oct 2008 11:51:02 -0700 Received: (qmail invoked by alias); 12 Oct 2008 18:50:48 -0000 Received: from 62-47-59-57.adsl.highway.telekom.at (EHLO [62.47.59.57]) [62.47.59.57] by mail.gmx.net (mp025) with SMTP; 12 Oct 2008 20:50:48 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX19iGcQPh0Bi1dW4R79NElxANvwijYC+dneBgIr+71 Rs7tX4Cz/fexuE Message-ID: <48F2468D.3040705@gmx.at> Date: Sun, 12 Oct 2008 20:48:45 +0200 From: martin rudalics User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Peter De Wachter CC: Chong Yidong , 1039@debbugs.gnu.org, Kenichi Handa References: <87iqs3oyg5.fsf@cyd.mit.edu> <48ECF5DD.7020104@gmx.at> <20081012001041.116d71e5@tleilaxu> In-Reply-To: <20081012001041.116d71e5@tleilaxu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.73 > That patch fixes the bug I reported, but it creates a new one: Are you sure that this worked _before_ my patch? > if you > change the EOL convention outside of emacs, revert-buffer no longer > detects this. Indeed. BTW, can you confirm that when you delete the entire buffer text first reverting works correctly? Unfortunately, I don't understand this part of `insert-file-contents' at all. I suppose Emacs should redecode when it finds out that the eol-types of the buffer and the part of the file it has already read differ. But somehow this doesn't happen. Handa-san do you have any ideas? martin From unknown Sun Aug 17 01:42:07 2025 X-Loop: don@donarmstrong.com Subject: bug#1039: 23.0.60; emacs forgets EOL convention after revert-buffer Reply-To: Peter De Wachter , 1039@debbugs.gnu.org Resent-From: Peter De Wachter Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Mon, 13 Oct 2008 20:00:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1039 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: patch Received: via spool by 1039-submit@emacsbugs.donarmstrong.com id=B1039.122392763529198 (code B ref 1039); Mon, 13 Oct 2008 20:00:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-5.8 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 1039) by emacsbugs.donarmstrong.com; 13 Oct 2008 19:53:55 +0000 Received: from lmailproxy03.edpnet.net (lmailproxy03.edpnet.net [212.71.1.196]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9DJrp8R029192 for <1039@emacsbugs.donarmstrong.com>; Mon, 13 Oct 2008 12:53:52 -0700 Received: from tleilaxu (213.219.137.163.adsl.dyn.edpnet.net [213.219.137.163]) by lmailproxy03.edpnet.net (8.13.1/8.13.1) with ESMTP id m9DJri8F029123; Mon, 13 Oct 2008 21:53:44 +0200 Received: from tleilaxu (localhost.localdomain [127.0.0.1]) by tleilaxu (Postfix) with ESMTP id EA8281628208; Mon, 13 Oct 2008 21:53:43 +0200 (CEST) Date: Mon, 13 Oct 2008 21:53:42 +0200 From: Peter De Wachter To: martin rudalics , Chong Yidong , 1039@debbugs.gnu.org Message-ID: <20081013215342.2be48064@tleilaxu> In-Reply-To: <48F2468D.3040705@gmx.at> References: <87iqs3oyg5.fsf@cyd.mit.edu> <48ECF5DD.7020104@gmx.at> <20081012001041.116d71e5@tleilaxu> <48F2468D.3040705@gmx.at> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.11; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.94/8415/Mon Oct 13 03:06:19 2008 on lmailproxy03.edpnet.net X-Virus-Status: Clean On Sun, 12 Oct 2008 20:48:45 +0200 martin rudalics wrote: > > That patch fixes the bug I reported, but it creates a new one: > > Are you sure that this worked _before_ my patch? Hm, I must have tried it with Emacs 22. It doesn't work in 23. Too many versions to juggle around. Sorry for the confusion. > > if you > > change the EOL convention outside of emacs, revert-buffer no longer > > detects this. > > Indeed. BTW, can you confirm that when you delete the entire buffer > text first reverting works correctly? Unfortunately, I don't Yes, it works if I clear the buffer first, both with and without your patch. > understand this part of `insert-file-contents' at all. I suppose > Emacs should redecode when it finds out that the eol-types of the > buffer and the part of the file it has already read differ. But > somehow this doesn't happen. Handa-san do you have any ideas? -- Peter De Wachter From unknown Sun Aug 17 01:42:07 2025 X-Loop: owner@emacsbugs.donarmstrong.com Subject: bug#1039: 23.0.60; emacs forgets EOL convention after revert-buffer Reply-To: Kenichi Handa , 1039@debbugs.gnu.org Resent-From: Kenichi Handa Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 29 Jan 2009 04:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-Emacs-PR-Message: followup 1039 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: patch Received: via spool by 1039-submit@emacsbugs.donarmstrong.com id=B1039.123320285226952 (code B ref 1039); Thu, 29 Jan 2009 04:30:03 +0000 Received: (at 1039) by emacsbugs.donarmstrong.com; 29 Jan 2009 04:20:52 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=0.0 required=4.0 tests=MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mx1.aist.go.jp (mx1.aist.go.jp [150.29.246.133]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0T4Km2x026945 for <1039@emacsbugs.donarmstrong.com>; Wed, 28 Jan 2009 20:20:49 -0800 Received: from rqsmtp2.aist.go.jp (rqsmtp2.aist.go.jp [150.29.254.123]) by mx1.aist.go.jp with ESMTP id n0T4KfGE010630; Thu, 29 Jan 2009 13:20:41 +0900 (JST) env-from (handa@m17n.org) Received: from smtp2.aist.go.jp by rqsmtp2.aist.go.jp with ESMTP id n0T4Kf8w000495; Thu, 29 Jan 2009 13:20:41 +0900 (JST) env-from (handa@m17n.org) Received: by smtp2.aist.go.jp with ESMTP id n0T4Kdn1006904; Thu, 29 Jan 2009 13:20:39 +0900 (JST) env-from (handa@m17n.org) Received: from handa by etlken with local (Exim 4.69) (envelope-from ) id 1LSOOX-0007ow-Oj; Thu, 29 Jan 2009 13:20:49 +0900 From: Kenichi Handa To: 1039@debbugs.gnu.org Cc: handa@m17n.org, pdewacht@gmail.com, rfrancoise@debian.org, cyd@stupidchicken.com Date: Thu, 29 Jan 2009 13:20:49 +0900 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > If you load a file with DOS line endings, and revert it with M-x > revert-buffer, emacs forgets the used EOL convention and will use > Unix line endings when writing the file. This problem is already fixed. > That patch fixes the bug I reported, but it creates a new one: if you > change the EOL convention outside of emacs, revert-buffer no longer > detects this. To reproduce: > > printf "hello\r\nworld\r\n" > hello > emacs -Q hello & > printf "hello\rworld\r" > hello > M-x revert-buffer > # emacs still sees DOS newlines This is already fixed too. But, the problem is the case that you load "hello" by explicitly specifying dos coding system, or you once save the file by dos coding sytem before reverting. In this case, Emacs respects your specification, and thus revert-buffer loads the file as dos coding system, which results in seeing many CR charaters in the above case. We think this behaviour is not a bug but a feature. --- Kenichi Handa handa@m17n.org From cyd@stupidchicken.com Wed Jan 28 21:25:39 2009 Received: (at control) by emacsbugs.donarmstrong.com; 29 Jan 2009 05:25:39 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=0.0 required=4.0 tests=none autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n0T5PaIe010524 for ; Wed, 28 Jan 2009 21:25:37 -0800 Received: by cyd.mit.edu (Postfix, from userid 1000) id 424C157E20A; Thu, 29 Jan 2009 00:26:08 -0500 (EST) From: Chong Yidong To: control@debbugs.gnu.org Subject: close 1039 Date: Thu, 29 Jan 2009 00:26:08 -0500 Message-ID: <87bptq3cpb.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii close 1039 thanks