From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Jan D." Newsgroups: gmane.emacs.devel Subject: Re: DOC for Mac OS shown for Emacs compiled for X. Date: Fri, 29 Oct 2004 10:00:53 +0200 (CEST) Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: <20041029080140.SPWE44.mxfep02.bredband.com@coolsville.localdomain> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1099037002 1171 80.91.229.6 (29 Oct 2004 08:03:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 29 Oct 2004 08:03:22 +0000 (UTC) Cc: Andreas Schwab , emacs devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 29 10:03:06 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CNRj0-0002iU-00 for ; Fri, 29 Oct 2004 10:03:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CNRqq-0001CU-2p for ged-emacs-devel@m.gmane.org; Fri, 29 Oct 2004 04:11:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CNRpw-0001CD-WE for emacs-devel@gnu.org; Fri, 29 Oct 2004 04:10:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CNRpv-0001C0-Vi for emacs-devel@gnu.org; Fri, 29 Oct 2004 04:10:16 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CNRpu-0001Bx-Vl for emacs-devel@gnu.org; Fri, 29 Oct 2004 04:10:15 -0400 Original-Received: from [195.54.107.73] (helo=mxfep02.bredband.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CNRhd-0001Ep-Q7 for emacs-devel@gnu.org; Fri, 29 Oct 2004 04:01:42 -0400 Original-Received: from coolsville.localdomain ([83.226.180.220] [83.226.180.220]) by mxfep02.bredband.com with ESMTP id <20041029080140.SPWE44.mxfep02.bredband.com@coolsville.localdomain>; Fri, 29 Oct 2004 10:01:40 +0200 In-Reply-To: "from Stefan at Oct 28, 2004 03:56:36 pm" Original-To: Stefan X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:29134 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:29134 > >>> 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);