unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Bad purecopy in ethiopic.el?
@ 2009-11-13  8:53 Eli Zaretskii
  2009-11-13 17:14 ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2009-11-13  8:53 UTC (permalink / raw)
  To: emacs-devel

Byte-compiling ethiopic.el produces this warning:

    Compiling lisp/language/ethiopic.el...

    In toplevel form:
    language/ethiopic.el:33:1:Warning: third arg to `defconst
	ccl-encode-ethio-font' is not a string: (purecopy CCL program to encode an
	Ethiopic code to code point of Ethiopic font.)




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

* Re: Bad purecopy in ethiopic.el?
  2009-11-13  8:53 Bad purecopy in ethiopic.el? Eli Zaretskii
@ 2009-11-13 17:14 ` Glenn Morris
  2009-11-13 17:57   ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2009-11-13 17:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii wrote:

>     language/ethiopic.el:33:1:Warning: third arg to `defconst
> 	ccl-encode-ethio-font' is not a string: (purecopy CCL program to encode an
> 	Ethiopic code to code point of Ethiopic font.)

Presumably purecopy'd strings are acceptable as doc-strings.
I think byte-compile-defvar should be patched something like this
(line numbers may be off):

***************
*** 3929,3937 ****
        (when (and (cddr form) (null byte-compile-current-form))
        `(push ',var current-load-list))
        (when (> (length form) 3)
!       (when (and string (not (stringp string)))
!         (byte-compile-warn "third arg to `%s %s' is not a string: %s"
!                            fun var string))
        `(put ',var 'variable-documentation ,string))
        (if (cddr form)         ; `value' provided
          (let ((byte-compile-not-obsolete-vars (list var)))
--- 3821,3832 ----
        (when (and (cddr form) (null byte-compile-current-form))
        `(push ',var current-load-list))
        (when (> (length form) 3)
!       (or (not string)
!           (stringp string)
!           (and (eq (car-safe string) 'purecopy)
!                (string-or-null-p (car-safe (cdr-safe string))))
!           (byte-compile-warn "third arg to `%s %s' is not a string: %s"
!                              fun var string))
        `(put ',var 'variable-documentation ,string))
        (if (cddr form)         ; `value' provided
          (let ((byte-compile-not-obsolete-vars (list var)))


Perhaps the string-or-null-p should be a stringp and ccl.el should
also be changed:

*** ccl.el      11 Nov 2009 06:18:20 -0000      1.52
--- ccl.el      13 Nov 2009 17:09:11 -0000
***************
*** 1523,1529 ****
                      (fset 'charset-id 'charset-id-internal)
                      (ccl-compile (eval ccl-program)))
                  (fmakunbound 'charset-id))))
!      (defconst ,name prog (purecopy ,doc))
       (put ',name 'ccl-program-idx (register-ccl-program ',name
       prog))
       nil))
  
--- 1523,1529 ----
                      (fset 'charset-id 'charset-id-internal)
                      (ccl-compile (eval ccl-program)))
                  (fmakunbound 'charset-id))))
!      (defconst ,name prog (if ,doc (purecopy ,doc)))
       (put ',name 'ccl-program-idx (register-ccl-program ',name
                      prog))
       nil))




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

* Re: Bad purecopy in ethiopic.el?
  2009-11-13 17:14 ` Glenn Morris
@ 2009-11-13 17:57   ` Andreas Schwab
  2009-11-14  2:03     ` Dan Nicolaescu
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2009-11-13 17:57 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Eli Zaretskii, emacs-devel

Glenn Morris <rgm@gnu.org> writes:

> Eli Zaretskii wrote:
>
>>     language/ethiopic.el:33:1:Warning: third arg to `defconst
>> 	ccl-encode-ethio-font' is not a string: (purecopy CCL program to encode an
>> 	Ethiopic code to code point of Ethiopic font.)
>
> Presumably purecopy'd strings are acceptable as doc-strings.

In fact any expression is acceptable (it's eval'd by
documentation-property).  But then, purecopy looks like a waste here,
since defconst already calls it implicitly.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




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

* Re: Bad purecopy in ethiopic.el?
  2009-11-13 17:57   ` Andreas Schwab
@ 2009-11-14  2:03     ` Dan Nicolaescu
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Nicolaescu @ 2009-11-14  2:03 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Eli Zaretskii, emacs-devel

Andreas Schwab <schwab@linux-m68k.org> writes:

  > Glenn Morris <rgm@gnu.org> writes:
  > 
  > > Eli Zaretskii wrote:
  > >
  > >>     language/ethiopic.el:33:1:Warning: third arg to `defconst
  > >> 	ccl-encode-ethio-font' is not a string: (purecopy CCL program to encode an
  > >> 	Ethiopic code to code point of Ethiopic font.)
  > >
  > > Presumably purecopy'd strings are acceptable as doc-strings.
  > 
  > In fact any expression is acceptable (it's eval'd by
  > documentation-property).  But then, purecopy looks like a waste here,
  > since defconst already calls it implicitly.

Exactly, I took out the purecopy. Thanks!




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

end of thread, other threads:[~2009-11-14  2:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-13  8:53 Bad purecopy in ethiopic.el? Eli Zaretskii
2009-11-13 17:14 ` Glenn Morris
2009-11-13 17:57   ` Andreas Schwab
2009-11-14  2:03     ` Dan Nicolaescu

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