unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#32395: 26.1; generated autoloads includes string properties if buffer is open
@ 2018-08-08  7:09 Allen Li
  2018-08-08  7:13 ` bug#32395: [PATCH] Don't include text properties when making autoloads Allen Li
  2018-08-11  9:18 ` bug#32395: 26.1; generated autoloads includes string properties if buffer is open Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Allen Li @ 2018-08-08  7:09 UTC (permalink / raw)
  To: 32395

The autoload generation code inserts a form with a string that may or
may not have text properties, depending on if the buffer is already
open.

(if (fboundp 'register-definition-prefixes)
             (register-definition-prefixes "foo"
                                           '(#("foo-" 0 4 (fontified nil)))))

(if (fboundp 'register-definition-prefixes)
             (register-definition-prefixes "foo" '("foo-")))

This makes autoload generation depend on the odd condition of whether
the file under consideration is already open and fontified.

In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-07-05 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.12000000

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 MODULES THREADS LIBSYSTEMD LCMS2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#32395: [PATCH] Don't include text properties when making autoloads
  2018-08-08  7:09 bug#32395: 26.1; generated autoloads includes string properties if buffer is open Allen Li
@ 2018-08-08  7:13 ` Allen Li
  2018-08-11  9:18 ` bug#32395: 26.1; generated autoloads includes string properties if buffer is open Eli Zaretskii
  1 sibling, 0 replies; 5+ messages in thread
From: Allen Li @ 2018-08-08  7:13 UTC (permalink / raw)
  To: 32395

[-- Attachment #1: Type: text/plain, Size: 27 bytes --]

Attached patch fixing this

[-- Attachment #2: 0001-Don-t-include-text-properties-when-making-autoloads.patch --]
[-- Type: text/x-patch, Size: 1912 bytes --]

From 8a12069f7115a0cb959aa178c2776fa9ee09c54c Mon Sep 17 00:00:00 2001
From: Allen Li <darkfeline@felesatra.moe>
Date: Wed, 8 Aug 2018 00:03:36 -0700
Subject: [PATCH] Don't include text properties when making autoloads

When text properties are included here, they get carried all the way
through to autoload--make-defs-autoload, which ends up inserting the
form.

(if (fboundp 'register-definition-prefixes)
             (register-definition-prefixes ,file ',(delq nil strings)))

This form ends up changing depending on whether or not the file for
which we are making autoloads is already open (and thus has text properties):

(if (fboundp 'register-definition-prefixes)
             (register-definition-prefixes "foo"
                                           '(#("foo-" 0 4 (fontified nil)))))

(if (fboundp 'register-definition-prefixes)
             (register-definition-prefixes "foo" '("foo-")))

This causes autoload generation (to appear) to be non-deterministic; the
contents change based on whether the file under consideration is
already open.

* lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads):
  Ignore text properties when finding autoload defs
---
 lisp/emacs-lisp/autoload.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index 92ad6155b5..be075cc2bf 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -765,7 +765,7 @@ autoload-generate-file-autoloads
                                      "define-erc-module"
                                      "define-erc-response-handler"
                                      "defun-rcirc-command"))))
-                    (push (match-string 2) defs))
+                    (push (match-string-no-properties 2) defs))
                             (forward-sexp 1)
                             (forward-line 1)))))))
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#32395: 26.1; generated autoloads includes string properties if buffer is open
  2018-08-08  7:09 bug#32395: 26.1; generated autoloads includes string properties if buffer is open Allen Li
  2018-08-08  7:13 ` bug#32395: [PATCH] Don't include text properties when making autoloads Allen Li
@ 2018-08-11  9:18 ` Eli Zaretskii
  2018-08-11  9:49   ` Allen Li
  1 sibling, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2018-08-11  9:18 UTC (permalink / raw)
  To: Allen Li; +Cc: 32395

> From: Allen Li <darkfeline@felesatra.moe>
> Date: Wed, 8 Aug 2018 00:09:22 -0700
> 
> The autoload generation code inserts a form with a string that may or
> may not have text properties, depending on if the buffer is already
> open.
> 
> (if (fboundp 'register-definition-prefixes)
>              (register-definition-prefixes "foo"
>                                            '(#("foo-" 0 4 (fontified nil)))))
> 
> (if (fboundp 'register-definition-prefixes)
>              (register-definition-prefixes "foo" '("foo-")))
> 
> This makes autoload generation depend on the odd condition of whether
> the file under consideration is already open and fontified.

Can you tell more about the use case where you see this?  Does this
happen when the autoload files in the Emacs tree are generated?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#32395: 26.1; generated autoloads includes string properties if buffer is open
  2018-08-11  9:18 ` bug#32395: 26.1; generated autoloads includes string properties if buffer is open Eli Zaretskii
@ 2018-08-11  9:49   ` Allen Li
  2018-08-17 14:10     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Allen Li @ 2018-08-11  9:49 UTC (permalink / raw)
  To: eliz; +Cc: 32395

On Sat, Aug 11, 2018 at 2:18 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Allen Li <darkfeline@felesatra.moe>
> > Date: Wed, 8 Aug 2018 00:09:22 -0700
> >
> > The autoload generation code inserts a form with a string that may or
> > may not have text properties, depending on if the buffer is already
> > open.
> >
> > (if (fboundp 'register-definition-prefixes)
> >              (register-definition-prefixes "foo"
> >                                            '(#("foo-" 0 4 (fontified nil)))))
> >
> > (if (fboundp 'register-definition-prefixes)
> >              (register-definition-prefixes "foo" '("foo-")))
> >
> > This makes autoload generation depend on the odd condition of whether
> > the file under consideration is already open and fontified.
>
> Can you tell more about the use case where you see this?  Does this
> happen when the autoload files in the Emacs tree are generated?

I use update-directory-autoloads to generate autoloads for personal
Emacs Lisp files.  The text changes depending on whether I have a
buffer open for any of said files, which is annoying as I have the
autoload file under source version control.  If I edit one file and
update autoloads, it will create a number of unrelated changes in
version control, depending on whether I have any other files open in
buffers or not.

I don't see why there is a need to preserve the text properties of the
package prefix in the autoload file, only when the file for which
autoloads are being generated is open in a buffer.  That seems like
very silly behavior to me and I would fix it on principle even if it
were not affecting my work flow.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#32395: 26.1; generated autoloads includes string properties if buffer is open
  2018-08-11  9:49   ` Allen Li
@ 2018-08-17 14:10     ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2018-08-17 14:10 UTC (permalink / raw)
  To: Allen Li; +Cc: 32395-done

> From: Allen Li <darkfeline@felesatra.moe>
> Date: Sat, 11 Aug 2018 02:49:30 -0700
> Cc: 32395@debbugs.gnu.org
> 
> > Can you tell more about the use case where you see this?  Does this
> > happen when the autoload files in the Emacs tree are generated?
> 
> I use update-directory-autoloads to generate autoloads for personal
> Emacs Lisp files.  The text changes depending on whether I have a
> buffer open for any of said files, which is annoying as I have the
> autoload file under source version control.  If I edit one file and
> update autoloads, it will create a number of unrelated changes in
> version control, depending on whether I have any other files open in
> buffers or not.
> 
> I don't see why there is a need to preserve the text properties of the
> package prefix in the autoload file, only when the file for which
> autoloads are being generated is open in a buffer.  That seems like
> very silly behavior to me and I would fix it on principle even if it
> were not affecting my work flow.

Thanks, I've pushed your changes to the master branch.  If as result
you no longer think of Emacs as being silly, we all win.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-08-17 14:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-08  7:09 bug#32395: 26.1; generated autoloads includes string properties if buffer is open Allen Li
2018-08-08  7:13 ` bug#32395: [PATCH] Don't include text properties when making autoloads Allen Li
2018-08-11  9:18 ` bug#32395: 26.1; generated autoloads includes string properties if buffer is open Eli Zaretskii
2018-08-11  9:49   ` Allen Li
2018-08-17 14:10     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).