From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.bugs Subject: bug#21492: 25.0.50: Make untabify work nicely with write-file-functions Date: Tue, 15 Sep 2015 23:35:37 -0400 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113d2cd642fe45051fd500c6 X-Trace: ger.gmane.org 1442374651 17868 80.91.229.3 (16 Sep 2015 03:37:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Sep 2015 03:37:31 +0000 (UTC) Cc: warren ferguson To: 21492@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 16 05:37:17 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zc3X2-0004Cc-K3 for geb-bug-gnu-emacs@m.gmane.org; Wed, 16 Sep 2015 05:37:16 +0200 Original-Received: from localhost ([::1]:47183 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zc3X1-0001Qc-P3 for geb-bug-gnu-emacs@m.gmane.org; Tue, 15 Sep 2015 23:37:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zc3Ww-0001Py-6b for bug-gnu-emacs@gnu.org; Tue, 15 Sep 2015 23:37:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zc3Wo-0005Aj-Nn for bug-gnu-emacs@gnu.org; Tue, 15 Sep 2015 23:37:10 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41569) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zc3Wo-0005Ad-3U for bug-gnu-emacs@gnu.org; Tue, 15 Sep 2015 23:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Zc3Wn-000433-Uj for bug-gnu-emacs@gnu.org; Tue, 15 Sep 2015 23:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kaushal Modi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 16 Sep 2015 03:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21492 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: "bug-gnu-emacs@gnu.org" Original-Received: via spool by submit@debbugs.gnu.org id=B.144237458615519 (code B ref -1); Wed, 16 Sep 2015 03:37:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Sep 2015 03:36:26 +0000 Original-Received: from localhost ([127.0.0.1]:33779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zc3WD-00042D-3S for submit@debbugs.gnu.org; Tue, 15 Sep 2015 23:36:25 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47492) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zc3WB-000426-8y for submit@debbugs.gnu.org; Tue, 15 Sep 2015 23:36:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zc3W9-0004tT-80 for submit@debbugs.gnu.org; Tue, 15 Sep 2015 23:36:23 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:54152) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zc3W9-0004tE-3y for submit@debbugs.gnu.org; Tue, 15 Sep 2015 23:36:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57495) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zc3W7-0001Lg-8u for bug-gnu-emacs@gnu.org; Tue, 15 Sep 2015 23:36:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zc3W5-0004ll-J9 for bug-gnu-emacs@gnu.org; Tue, 15 Sep 2015 23:36:19 -0400 Original-Received: from mail-oi0-x22c.google.com ([2607:f8b0:4003:c06::22c]:36621) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zc3W5-0004kX-7A for bug-gnu-emacs@gnu.org; Tue, 15 Sep 2015 23:36:17 -0400 Original-Received: by oibi136 with SMTP id i136so110342784oib.3 for ; Tue, 15 Sep 2015 20:36:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:cc:content-type; bh=22vC/q7A7yiYyuYjPncq4f0aWc+lyByE2ICy9tDuZMg=; b=Il1Ol0aI72Z0cRr8/kTmyVshL+DnJ5+z9H2HAFWqflz4w5DR/0i09Wg3rxp7LzuH9A D5uQXpJEO6HeI3eLBfNYrZybtjeig3q25Y4Rz9Oarh0Bt4GXDNtXev0x2Uj1fJprVCh1 hLHghYCYArN1Xh4wYEJaCkt4h92BKqwasMWTD66O2UrlyUhpoH3q2fkAP1pr0jDxaFUv pDyy8AeTSC+znw0X64MasNvi3sXIYNcRQP747qany7OIV7mmD0onn57irYsn+VSUFpTf TJ/eWO16+ifE8K2Bd0kr/r1YJHaiN4noDcHVqCh09XVSgo8VLAxOBCq6xZk1wd+uBMq9 lpzg== X-Received: by 10.202.211.10 with SMTP id k10mr20965611oig.34.1442374576436; Tue, 15 Sep 2015 20:36:16 -0700 (PDT) Original-Received: by 10.202.172.205 with HTTP; Tue, 15 Sep 2015 20:35:37 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:106619 Archived-At: --001a113d2cd642fe45051fd500c6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, I personally have dealt with the issue where I cannot add untabify directly to write-file-functions hook, because untabify does not return nil. I need some sort of custom wrapper that runs untabify and then returns nil. Today I noticed that another user on help-gnu-emacs list faced the same problem. That made me submit this minor edit to the untabify function; it simply returns nil. I noticed that similar edit had to be done for another function commonly added to write-file-functions: delete-trailing-whitespace= . PATCH follows: >From 1e12773ffa7c94610df070e38aaf8b2315c18fa8 Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Tue, 15 Sep 2015 23:24:27 -0400 Subject: [PATCH] Make untabify work with write-file-functions hook - write-file-functions requires the hooked functions to return nil in order to proceed with the file saving. - So the return value of untabify is set to nil. --- lisp/tabify.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/tabify.el b/lisp/tabify.el index c2f4e0c..9df3eaa 100644 --- a/lisp/tabify.el +++ b/lisp/tabify.el @@ -53,7 +53,9 @@ The variable `tab-width' controls the spacing of tab stops." (setq column (current-column)) (delete-region tab-beg (point)) (indent-to column))))) - (move-to-column c))) + (move-to-column c)) + ;; Return nil for the benefit of `write-file-functions'. + nil) (defvar tabify-regexp " [ \t]+" "Regexp matching whitespace that tabify should consider. --=20 2.6.0.rc0.24.gec371ff =E2=80=8BPlease review and commit to the master branch if this is fine. For these few lines, I will not need the copyright paperwork, but I would like to mention that I have already got the copyright paperwork approved and in place=E2=80=8B (#1029578). -- Kaushal Modi On Tue, Sep 15, 2015 at 6:58 PM, warren ferguson wrote: > You are correct. > In my .emacs file I too had a detabify function, and when I added nil as > the return value my saves started working. > Thanks so much, Warren > > ------------------------------ > Date: Tue, 15 Sep 2015 17:55:56 -0400 > Subject: Re: Issues with edited files not being saved > From: kaushal.modi@gmail.com > To: gobold1y@hotmail.com > > > Have you added functions to the write-file-functions hook? Or to the old > hook name that this new name obsoleted? > > If so, make sure that all of those functions return nil. To test if one o= r > more of the functions added to this hook are a problem, remove all > functions from the hook, and then saving should work fine. > > I had to create a custom untabify function that returned nil to fix this > issue: > https://github.com/kaushalmodi/.emacs.d/blob/master/setup-files/setup-edi= ting.el#L99 > On Sep 15, 2015 5:22 PM, "warren ferguson" wrote: > > I've just downloaded and build a recent version of emacs. > > GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll bars) > > head -n 1 /.image > LinuxSET EC Image SLES11SP2-2 Revision 0 ia32e > > sysname -afs > x86-64_linux30 > > Unfortunately, when I edit a file and try to save it, the status line > shows the usual "saving" message but that message never goes away > indicating the save completed. While the attempt to save is ongoing, I ca= n > go to the terminal window and check that the file has not been updated to > reflect the edits. > Interestingly, if I save the edited file to a new unused file name, the > save does complete. > How do I determine why emacs is unable to write over the original file? > I checked file permissions, and they don't seem to be the source of the > problem. Indeed, the emacs (version 23.2.1) that came with the OS is able > to save edits to the same file. > > > --001a113d2cd642fe45051fd500c6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

I personally have dealt with the iss= ue where I cannot add untabify directly to write-file-functions hook, becau= se untabify does not return nil.

<= div class=3D"gmail_default" style=3D"font-family:'trebuchet ms',san= s-serif;font-size:small">I need some sort of custom wrapper that runs untab= ify and then returns nil.

Today I noticed that another user on help-gnu-emacs list = faced the same problem.

That made me submit this minor edit to the untabify functio= n; it simply returns nil. I noticed that similar edit had to be done for an= other function commonly added to write-file-functions: delete-trailing-whit= espace.

= PATCH follows:

From 1e12773ffa7c94610df070e38aaf8b2315c18fa8 Mon= Sep 17 00:00:00 2001
<= font face=3D"trebuchet ms, sans-serif">From: Kaushal Modi <kaushal.modi@gmail.com>
Subject: [PATCH] M= ake untabify work with write-file-functions hook

- write-file-functions requires the hooked functions to return= nil in
=C2=A0 order to proceed with the file saving.
- So the return value of untabify is set to nil.
<= div class=3D"gmail_default" style=3D"">---
=C2=A0lisp/tabify.el | 4 +++-
=C2= =A01 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/tabify.el b/lisp/tabify.el
index c2f4e0c..9df3eaa 100644
--- a/lisp/tabify.el=
+++ b/lisp/tabify.el
@@ -53,7 +53,9 @@ The vari= able `tab-width' controls the spacing of tab stops."
<= div class=3D"gmail_default" style=3D"">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq column (current-c= olumn))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(d= elete-region tab-beg (point))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(indent-to column)))))
- =C2=A0 =C2=A0= (move-to-column c)))
+ =C2=A0 =C2=A0(move-to-column c))
+ =C2=A0;; Return nil for the benefit of `write-file-functio= ns'.
+ =C2=A0nil)
=C2=A0
=
=C2=A0(defvar tabify-regexp " [ \t]+"
=C2= =A0 =C2=A0"Regexp matching whitespace that tabify should consider.
--=C2=A0
= 2.6.0.rc0.24.gec371ff
<= div class=3D"gmail_default" style=3D"font-family:'trebuchet ms',san= s-serif;font-size:small">
=E2=80=8BPlease review and commit to the master branch i= f this is fine.

For these few lines, I will not need the copyright paperwork, but I= would like to mention that I have already got the copyright paperwork appr= oved and in place=E2=80=8B (#1029578).


--Kaushal Modi

On Tue, Sep 15, 2015 at 6:58 PM, warren ferg= uson <gobold1y@hotmail.com> wrote:
You are correct.
In my .emacs file I too had a de= tabify function, and when I added nil as the return value my saves started = working.
Thanks so much, Warren


Date: Tue, 15 Sep 2015 17:55:56 -0400
Subject: Re: Issues= with edited files not being saved
From: kaushal.modi@gmail.com
To: gobold1y@hotmail.com


Have you added functions to = the write-file-functions hook? Or to the old hook name that this new name o= bsoleted?

If so, make sure that all of those functions return nil. To = test if one or more of the functions added to this hook are a problem, remo= ve all functions from the hook, and then saving should work fine.

I had to create a custom untabify function that returned nil= to fix this issue: https://github.= com/kaushalmodi/.emacs.d/blob/master/setup-files/setup-editing.el#L99

On Sep 15, 2015 5:22 PM, "warren ferguson" <gobold1y@hotmail.com> w= rote:
I've just downloa= ded and build a recent version of emacs.

GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll bars)
> head -n 1 /.image
LinuxSET EC Image SLES11SP2-2 Revision 0 ia32e
> sysname -afs
x86-64_linux30

Unfortunately, when I edit a file and try to save it, the status line shows= the usual "saving" message but that message never goes away indi= cating the save completed. While the attempt to save is ongoing, I can go t= o the terminal window and check that the file has not been updated to refle= ct the edits.
Interestingly, if I save the edited file to a new unused file name, the sav= e does complete.
How do I determine why emacs is unable to write over the original file?
I checked file permissions, and they don't seem to be the source of the= problem. Indeed, the emacs (version 23.2.1) that came with the OS is able = to save edits to the same file.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <= /blockquote>

--001a113d2cd642fe45051fd500c6--