emacs-devel
[Top][All Lists]
Advanced

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

Re: DOC for Mac OS shown for Emacs compiled for X.


From: Jan D.
Subject: Re: DOC for Mac OS shown for Emacs compiled for X.
Date: Fri, 29 Oct 2004 10:00:53 +0200 (CEST)

> >>> What does that mean exactly?  Should I be able to take a DOC produced
> >>> on a Mac and use it on GNU/Linux or W32?
> >> Yes.  That's why it is installed below $datadir.
> > Okay, then there is trouble, because that does not work today.
> 
> Yes, it gets broken fairly often.  We should fix it.
> 

Is the approach in the attached patch OK?  I generate a list with the objects 
used to build Emacs and in Snarf-documentation I compare the files in DOC with 
that list.  If not in that list, those sections in DOC are skipped.

Probably some adjustments needs to be made for w32 and msdos, I think someone 
mentioned that they put .c file names into DOC, and also build files are not 
named .o, but .obj.  The code that finds the C source should be adjusted to 
look at the list also.

The tests I've done suggests this fixes the problem I originally encountered, 
and I have not seen any regression.  But I am not all that familiar with the 
help code, so I may have overlooked something obvious.

Comments?

        Jan D.

diff -c Makefile.in.~1.303.~ Makefile.in
Index: Makefile.in
*** Makefile.in.~1.303.~        2004-10-20 17:44:02.000000000 +0200
--- Makefile.in 2004-10-28 21:46:59.000000000 +0200
***************
*** 943,953 ****
  #define MAKE_PARALLEL
  #endif
  
! temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu 
${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT}
        $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \
      -o temacs ${STARTFILES} ${obj} ${otherobj}  \
      OBJECTS_MACHINE ${LIBES}
  
  /* We don't use ALL_LDFLAGS because LD_SWITCH_SYSTEM and LD_SWITCH_MACHINE
     often contain options that have to do with using Emacs's crt0,
     which are only good with temacs.  */
--- 943,956 ----
  #define MAKE_PARALLEL
  #endif
  
! temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu 
${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT} buildobj.lst
        $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \
      -o temacs ${STARTFILES} ${obj} ${otherobj}  \
      OBJECTS_MACHINE ${LIBES}
  
+ buildobj.lst:
+       echo "${obj} ${otherobj} " OBJECTS_MACHINE > buildobj.lst
+ 
  /* We don't use ALL_LDFLAGS because LD_SWITCH_SYSTEM and LD_SWITCH_MACHINE
     often contain options that have to do with using Emacs's crt0,
     which are only good with temacs.  */
diff -c doc.c.~1.108.~ doc.c
Index: doc.c
*** doc.c.~1.108.~      2004-10-28 22:22:33.000000000 +0200
--- doc.c       2004-10-29 09:59:45.000000000 +0200
***************
*** 51,56 ****
--- 51,59 ----
  
  Lisp_Object Qfunction_documentation;
  
+ /* A list of files used to build this Emacs binary.  */
+ static Lisp_Object Vbuild_files;
+ 
  extern Lisp_Object Voverriding_local_map;
  
  /* For VMS versions with limited file name syntax,
***************
*** 581,586 ****
--- 584,590 ----
    register char *p, *end;
    Lisp_Object sym;
    char *name;
+   int skip_file = 0;
  
    CHECK_STRING (filename);
  
***************
*** 617,622 ****
--- 621,656 ----
    strcpy (name, sys_translate_unix (name));
  #endif /* VMS4_4 */
  #endif /* VMS */
+   
+   {
+     size_t cp_size = 0;
+     size_t to_read;
+     int nr_read;
+     char *cp = NULL;
+ 
+     fd = emacs_open ("buildobj.lst", O_RDONLY, 0);
+     if (fd < 0)
+       report_file_error ("Opening file buildobj.lst", Qnil);
+ 
+     filled = 0;
+     for (;;)
+       {
+         cp_size += 1024;
+         to_read = cp_size - 1 - filled;
+         cp = xrealloc (cp, cp_size);
+         nr_read = emacs_read (fd, &cp[filled], to_read);
+         filled += nr_read;
+         if (nr_read < to_read)
+           break;
+       }
+ 
+     cp[filled] = 0;
+ 
+     Vbuild_files = Feval (Fcons (intern ("split-string"),
+                                  Fcons (build_string (cp), Qnil)));
+     emacs_close (fd);
+     xfree (cp);
+   }
  
    fd = emacs_open (name, O_RDONLY, 0);
    if (fd < 0)
***************
*** 640,649 ****
        if (p != end)
        {
          end = (char *) index (p, '\n');
          sym = oblookup (Vobarray, p + 2,
                          multibyte_chars_in_text (p + 2, end - p - 2),
                          end - p - 2);
!         if (SYMBOLP (sym))
            {
              /* Attach a docstring to a variable?  */
              if (p[1] == 'V')
--- 674,698 ----
        if (p != end)
        {
          end = (char *) index (p, '\n');
+ 
+           /* See if this is a file name, and if it is a file in build-files.  
*/
+           if (p[1] == 'S' && end - p > 4 && end[-2] == '.' && end[-1] == 'o')
+             {
+               int len = end - p - 2;
+               char *fromfile = alloca (len + 1);
+               strncpy (fromfile, &p[2], len);
+               fromfile[len] = 0;
+ 
+               if (EQ (Fmember (build_string (fromfile), Vbuild_files), Qnil))
+                 skip_file = 1;
+               else
+                 skip_file = 0;
+             }
+ 
          sym = oblookup (Vobarray, p + 2,
                          multibyte_chars_in_text (p + 2, end - p - 2),
                          end - p - 2);
!         if (! skip_file && SYMBOLP (sym))
            {
              /* Attach a docstring to a variable?  */
              if (p[1] == 'V')
***************
*** 919,924 ****
--- 968,977 ----
               doc: /* Name of file containing documentation strings of 
built-in symbols.  */);
    Vdoc_file_name = Qnil;
  
+   DEFVAR_LISP ("build-files", &Vbuild_files,
+                doc: /* A list of files used to build this Emacs binary.  */);
+   Vbuild_files = Qnil;
+ 
    defsubr (&Sdocumentation);
    defsubr (&Sdocumentation_property);
    defsubr (&Ssnarf_documentation);




reply via email to

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