unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#30068: 26.0; REGRESSION: no doc for `x-display-pixel-*'
@ 2018-01-10 18:11 Drew Adams
  2018-01-10 19:26 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Drew Adams @ 2018-01-10 18:11 UTC (permalink / raw)
  To: 30068

In Emacs 25.3.1, `C-h f x-display-pixel-width':

 x-display-pixel-width is a built-in function in 'C source code'.

 (x-display-pixel-width &optional DISPLAY)

 Return the width in pixels of DISPLAY.
 The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.

 On "multi-monitor" setups this refers to the pixel width for all
 physical monitors associated with DISPLAY.  To get information for
 each physical monitor, use 'display-monitor-attributes-list'.

In Emacs 26 pretest:

 x-display-pixel-width is a built-in function in 'C source code'.

 (x-display-pixel-width &optional FRAME)

 Not documented.

I find nothing in NEWS about this.



In GNU Emacs 26.0.90 (build 3, x86_64-w64-mingw32)
 of 2017-10-13
Repository revision: 906224eba147bdfc0514090064e8e8f53160f1d4
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static -g3''





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

* bug#30068: 26.0; REGRESSION: no doc for `x-display-pixel-*'
  2018-01-10 18:11 bug#30068: 26.0; REGRESSION: no doc for `x-display-pixel-*' Drew Adams
@ 2018-01-10 19:26 ` Eli Zaretskii
  2018-01-10 19:41   ` Glenn Morris
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2018-01-10 19:26 UTC (permalink / raw)
  To: Drew Adams; +Cc: 30068-done

> Date: Wed, 10 Jan 2018 10:11:41 -0800 (PST)
> From: Drew Adams <drew.adams@oracle.com>
> 
> In Emacs 26 pretest:
> 
>  x-display-pixel-width is a built-in function in 'C source code'.
> 
>  (x-display-pixel-width &optional FRAME)
> 
>  Not documented.

Thanks, fixed.

> I find nothing in NEWS about this.

We don't yet document bugs in NEWS, let alone unknown bugs.





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

* bug#30068: 26.0; REGRESSION: no doc for `x-display-pixel-*'
  2018-01-10 19:26 ` Eli Zaretskii
@ 2018-01-10 19:41   ` Glenn Morris
  2018-01-10 20:21     ` Eli Zaretskii
  2018-01-11 19:51     ` Richard Stallman
  0 siblings, 2 replies; 12+ messages in thread
From: Glenn Morris @ 2018-01-10 19:41 UTC (permalink / raw)
  To: 30068


The doc for these x- functions is now stored in quadruplicate
(src/xfns.c, src/w32fns.c, src/nsfns.m, lisp/term/pc-win.el).

Is there a better way?





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

* bug#30068: 26.0; REGRESSION: no doc for `x-display-pixel-*'
  2018-01-10 19:41   ` Glenn Morris
@ 2018-01-10 20:21     ` Eli Zaretskii
  2018-01-11 19:26       ` Glenn Morris
  2018-01-11 19:51     ` Richard Stallman
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2018-01-10 20:21 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 30068

> From: Glenn Morris <rgm@gnu.org>
> Cc: eliz@gnu.org
> Date: Wed, 10 Jan 2018 14:41:42 -0500
> 
> 
> The doc for these x- functions is now stored in quadruplicate
> (src/xfns.c, src/w32fns.c, src/nsfns.m, lisp/term/pc-win.el).
> 
> Is there a better way?

I hope there is, and I'm all for seeking one.





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

* bug#30068: 26.0; REGRESSION: no doc for `x-display-pixel-*'
  2018-01-10 20:21     ` Eli Zaretskii
@ 2018-01-11 19:26       ` Glenn Morris
  2018-01-11 20:19         ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Glenn Morris @ 2018-01-11 19:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30068

Eli Zaretskii wrote:

>> The doc for these x- functions is now stored in quadruplicate
>> (src/xfns.c, src/w32fns.c, src/nsfns.m, lisp/term/pc-win.el).
>> 
>> Is there a better way?
>
> I hope there is, and I'm all for seeking one.

How about:

Keep the real doc only in xfns.c, makes the others just say <skip>, or
<see:xfns.c>, and change Fsnarf_documentation to respect <skip>.

Related: I see Fsnarf_documentation already has skip_file, but it
doesn't handle lisp files. Maybe it could be taught about
preloaded-file-list, which would have avoided this particular problem.





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

* bug#30068: 26.0; REGRESSION: no doc for `x-display-pixel-*'
  2018-01-10 19:41   ` Glenn Morris
  2018-01-10 20:21     ` Eli Zaretskii
@ 2018-01-11 19:51     ` Richard Stallman
  1 sibling, 0 replies; 12+ messages in thread
From: Richard Stallman @ 2018-01-11 19:51 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 30068

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > The doc for these x- functions is now stored in quadruplicate
  > (src/xfns.c, src/w32fns.c, src/nsfns.m, lisp/term/pc-win.el).

  > Is there a better way?

We could surely implement one, if it that is less work
that maintaining these doc strings in 4 places.

-- 
Dr Richard Stallman
President, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
Skype: No way! See https://stallman.org/skype.html.






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

* bug#30068: 26.0; REGRESSION: no doc for `x-display-pixel-*'
  2018-01-11 19:26       ` Glenn Morris
@ 2018-01-11 20:19         ` Eli Zaretskii
  2018-01-11 20:25           ` Eli Zaretskii
  2018-01-13  0:16           ` Glenn Morris
  0 siblings, 2 replies; 12+ messages in thread
From: Eli Zaretskii @ 2018-01-11 20:19 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 30068

> From: Glenn Morris <rgm@gnu.org>
> Cc: 30068@debbugs.gnu.org
> Date: Thu, 11 Jan 2018 14:26:02 -0500
> 
> Keep the real doc only in xfns.c, makes the others just say <skip>, or
> <see:xfns.c>, and change Fsnarf_documentation to respect <skip>.

Sounds fine.  Are there any downsides?

> Related: I see Fsnarf_documentation already has skip_file, but it
> doesn't handle lisp files. Maybe it could be taught about
> preloaded-file-list, which would have avoided this particular problem.

Not sure how: pc-win.el is preloaded (on some platforms).  Or maybe I
misunderstand you.





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

* bug#30068: 26.0; REGRESSION: no doc for `x-display-pixel-*'
  2018-01-11 20:19         ` Eli Zaretskii
@ 2018-01-11 20:25           ` Eli Zaretskii
  2018-01-13  0:16           ` Glenn Morris
  1 sibling, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2018-01-11 20:25 UTC (permalink / raw)
  To: rgm; +Cc: 30068

> Date: Thu, 11 Jan 2018 22:19:18 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 30068@debbugs.gnu.org
> 
> > From: Glenn Morris <rgm@gnu.org>
> > Cc: 30068@debbugs.gnu.org
> > Date: Thu, 11 Jan 2018 14:26:02 -0500
> > 
> > Keep the real doc only in xfns.c, makes the others just say <skip>, or
> > <see:xfns.c>, and change Fsnarf_documentation to respect <skip>.
> 
> Sounds fine.  Are there any downsides?

Btw, there's another, perhaps easier alternative: have only one
definition of the function, with the single copy of the doc string,
and then make it call the platform-dependent parts on the C level.





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

* bug#30068: 26.0; REGRESSION: no doc for `x-display-pixel-*'
  2018-01-11 20:19         ` Eli Zaretskii
  2018-01-11 20:25           ` Eli Zaretskii
@ 2018-01-13  0:16           ` Glenn Morris
  2018-01-13  7:50             ` Eli Zaretskii
  1 sibling, 1 reply; 12+ messages in thread
From: Glenn Morris @ 2018-01-13  0:16 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30068


Eli Zaretskii wrote:

>> Keep the real doc only in xfns.c, makes the others just say <skip>, or
>> <see:xfns.c>, and change Fsnarf_documentation to respect <skip>.
>
> Sounds fine.  Are there any downsides?

I can't think of any.

>> Related: I see Fsnarf_documentation already has skip_file, but it
>> doesn't handle lisp files. Maybe it could be taught about
>> preloaded-file-list, which would have avoided this particular problem.
>
> Not sure how: pc-win.el is preloaded (on some platforms).  Or maybe I
> misunderstand you.

If Fsnarf_documentation had skipped the pc-win definition on platforms
that did not load pc-win, the problem would have been confined to
platforms that do load pc-win. There's only one such: MS-DOS, where
no-one's interested in the doc of these functions, so it wouldn't matter.

> Btw, there's another, perhaps easier alternative: have only one
> definition of the function, with the single copy of the doc string,
> and then make it call the platform-dependent parts on the C level.

That would be (much) better, but I think it's (much) harder
(bug#4402 saw no interest in 8+ years).
If anyone ever does it, we won't need a workaround any more.

Here's the basic patch for my suggestion.
Turns out we can (and must) get rid of skip_files.
In addition, all the X/W32/NS "x-" doc-strings need to be combined so
that the X version describes all platforms. I thought this was already
done, but in one of the first cases I looked it, it wasn't. But this has
to be done anyway in the "real" solution, so the effort won't be wasted.


--- i/src/doc.c
+++ w/src/doc.c
@@ -535,7 +535,6 @@ it specifies the file name (without a directory) of the DOC file.
   EMACS_INT pos;
   Lisp_Object sym;
   char *p, *name;
-  bool skip_file = 0;
   ptrdiff_t count;
   char const *dirname;
   ptrdiff_t dirlen;
@@ -609,34 +608,24 @@ it specifies the file name (without a directory) of the DOC file.
 	{
 	  end = strchr (p, '\n');
 
-          /* See if this is a file name, and if it is a file in build-files.  */
-          if (p[1] == 'S')
-            {
-              skip_file = 0;
-              if (end - p > 4 && end[-2] == '.'
-                  && (end[-1] == 'o' || end[-1] == 'c'))
-                {
-                  ptrdiff_t len = end - p - 2;
-                  char *fromfile = SAFE_ALLOCA (len + 1);
-                  memcpy (fromfile, &p[2], len);
-                  fromfile[len] = 0;
-                  if (fromfile[len-1] == 'c')
-                    fromfile[len-1] = 'o';
-
-                  skip_file = NILP (Fmember (build_string (fromfile),
-                                             Vbuild_files));
-                }
-            }
+	  /* We used to skip files not in build_files, so that when a
+	     function is defined several times in different files
+	     (typically, once in xterm, once in w32term, ...), we only
+	     pay attention to the one that matters.
+
+	     But this means the doc has to be kept and updated in
+	     multiple files. Nowadays we keep the doc only in eg xterm.
+	     The (f)boundp checks below ensure we don't report
+	     docs for eg w32-specific items on X.
+	  */
 
 	  sym = oblookup (Vobarray, p + 2,
 			  multibyte_chars_in_text ((unsigned char *) p + 2,
 						   end - p - 2),
 			  end - p - 2);
-	  /* Check skip_file so that when a function is defined several
-	     times in different files (typically, once in xterm, once in
-	     w32term, ...), we only pay attention to the one that
-	     matters.  */
-	  if (! skip_file && SYMBOLP (sym))
+          /* Ignore docs that start with SKIP.  These mark
+             placeholders where the real doc is elsewhere.  */
+	  if (SYMBOLP (sym))
 	    {
 	      /* Attach a docstring to a variable?  */
 	      if (p[1] == 'V')
@@ -644,8 +633,9 @@ it specifies the file name (without a directory) of the DOC file.
 		  /* Install file-position as variable-documentation property
 		     and make it negative for a user-variable
 		     (doc starts with a `*').  */
-                  if (!NILP (Fboundp (sym))
+                  if ((!NILP (Fboundp (sym))
                       || !NILP (Fmemq (sym, delayed_init)))
+                      && strncmp (end, "\nSKIP", 5))
                     Fput (sym, Qvariable_documentation,
                           make_number ((pos + end + 1 - buf)
                                        * (end[1] == '*' ? -1 : 1)));
@@ -654,7 +644,7 @@ it specifies the file name (without a directory) of the DOC file.
 	      /* Attach a docstring to a function?  */
 	      else if (p[1] == 'F')
                 {
-                  if (!NILP (Ffboundp (sym)))
+                  if (!NILP (Ffboundp (sym)) && strncmp (end, "\nSKIP", 5))
                     store_function_docstring (sym, pos + end + 1 - buf);
                 }
 	      else if (p[1] == 'S')





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

* bug#30068: 26.0; REGRESSION: no doc for `x-display-pixel-*'
  2018-01-13  0:16           ` Glenn Morris
@ 2018-01-13  7:50             ` Eli Zaretskii
  2018-01-20 18:14               ` Glenn Morris
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2018-01-13  7:50 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 30068

> From: Glenn Morris <rgm@gnu.org>
> Cc: 30068@debbugs.gnu.org
> Date: Fri, 12 Jan 2018 19:16:09 -0500
> 
> >> Related: I see Fsnarf_documentation already has skip_file, but it
> >> doesn't handle lisp files. Maybe it could be taught about
> >> preloaded-file-list, which would have avoided this particular problem.
> >
> > Not sure how: pc-win.el is preloaded (on some platforms).  Or maybe I
> > misunderstand you.
> 
> If Fsnarf_documentation had skipped the pc-win definition on platforms
> that did not load pc-win, the problem would have been confined to
> platforms that do load pc-win. There's only one such: MS-DOS, where
> no-one's interested in the doc of these functions, so it wouldn't matter.

So you want to special-case pc-win.el?  I thought this was a more
general proposal.

> Here's the basic patch for my suggestion.
> Turns out we can (and must) get rid of skip_files.
> In addition, all the X/W32/NS "x-" doc-strings need to be combined so
> that the X version describes all platforms. I thought this was already
> done, but in one of the first cases I looked it, it wasn't. But this has
> to be done anyway in the "real" solution, so the effort won't be wasted.

I'm not sure I understand: I thought we made all the doc strings of
such functions identical some time ago, to avoid this issue.  Which
doc strings are not identical between different implementations?

> +          /* Ignore docs that start with SKIP.  These mark
> +             placeholders where the real doc is elsewhere.  */

This must be in the ELisp manual, of course, and perhaps also in NEWS.

Thanks.





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

* bug#30068: 26.0; REGRESSION: no doc for `x-display-pixel-*'
  2018-01-13  7:50             ` Eli Zaretskii
@ 2018-01-20 18:14               ` Glenn Morris
  2018-01-20 18:58                 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Glenn Morris @ 2018-01-20 18:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30068

Eli Zaretskii wrote:

> So you want to special-case pc-win.el?

No.

>  I thought this was a more general proposal.

Yes.

>> In addition, all the X/W32/NS "x-" doc-strings need to be combined so
>> that the X version describes all platforms. I thought this was already
>> done, but in one of the first cases I looked it, it wasn't. But this has
>> to be done anyway in the "real" solution, so the effort won't be wasted.
>
> I'm not sure I understand: I thought we made all the doc strings of
> such functions identical some time ago, to avoid this issue.  Which
> doc strings are not identical between different implementations?

The first one I happened to look at was x-server-max-request-size.
Cf nsfns.m and xfns.c.

>> +          /* Ignore docs that start with SKIP.  These mark
>> +             placeholders where the real doc is elsewhere.  */
>
> This must be in the ELisp manual, of course, and perhaps also in NEWS.

I don't see why an internal implementation detail that will be
self-documenting ("SKIP: real doc in xfns.c") needs to be in the
manual and NEWS, but if you say so.


Is this change then approved?





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

* bug#30068: 26.0; REGRESSION: no doc for `x-display-pixel-*'
  2018-01-20 18:14               ` Glenn Morris
@ 2018-01-20 18:58                 ` Eli Zaretskii
  0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2018-01-20 18:58 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 30068

> From: Glenn Morris <rgm@gnu.org>
> Cc: 30068@debbugs.gnu.org
> Date: Sat, 20 Jan 2018 13:14:06 -0500
> 
> >> +          /* Ignore docs that start with SKIP.  These mark
> >> +             placeholders where the real doc is elsewhere.  */
> >
> > This must be in the ELisp manual, of course, and perhaps also in NEWS.
> 
> I don't see why an internal implementation detail that will be
> self-documenting ("SKIP: real doc in xfns.c") needs to be in the
> manual and NEWS, but if you say so.

We need this in the manual so that people who write such doc strings
will know to use this facility in the future.

> Is this change then approved?

I'm okay with it, yes.

Thanks.





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

end of thread, other threads:[~2018-01-20 18:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-10 18:11 bug#30068: 26.0; REGRESSION: no doc for `x-display-pixel-*' Drew Adams
2018-01-10 19:26 ` Eli Zaretskii
2018-01-10 19:41   ` Glenn Morris
2018-01-10 20:21     ` Eli Zaretskii
2018-01-11 19:26       ` Glenn Morris
2018-01-11 20:19         ` Eli Zaretskii
2018-01-11 20:25           ` Eli Zaretskii
2018-01-13  0:16           ` Glenn Morris
2018-01-13  7:50             ` Eli Zaretskii
2018-01-20 18:14               ` Glenn Morris
2018-01-20 18:58                 ` Eli Zaretskii
2018-01-11 19:51     ` Richard Stallman

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).