[Top][All Lists]

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

bug#32979: 27.0.50; Oddity in #'keywordp comments.

From: Aidan Kehoe
Subject: bug#32979: 27.0.50; Oddity in #'keywordp comments.
Date: Sun, 7 Oct 2018 23:03:25 +0100

When I read the source for the Lisp function #'keywordp, in data.c, I
encounter the following:

/* Define this in C to avoid unnecessarily consing up the symbol
   name.  */
DEFUN ("keywordp", Fkeywordp, Skeywordp, 1, 1, 0,
       doc: /* Return t if OBJECT is a keyword.
This means that it is a symbol with a print name beginning with `:'
interned in the initial obarray.  */)
  (Lisp_Object object)
  if (SYMBOLP (object)
      && SREF (SYMBOL_NAME (object), 0) == ':'
    return Qt;
  return Qnil;

It's completely reasonable to implement the #'keywordp predicate in C given
the internal GNU Emacs approach to keywords. The equivalent Lisp
implementation of:

(defun keywordp (object)
  (and object (symbolp object) (eq ?: (aref (symbol-name object) 0))
       (eq object (intern-soft (symbol-name object) obarray))))

involves a hash table lookup after a Lisp funcall, and checking #'keywordp
should be cheap. The comment, however, has nothing to do with anything, there
is no consing or other dynamic memory allocation at any point, neither in the
obvious Lisp implementation, the old cl-compat.el implementation of 20.7, nor
the current code. The comment should be removed.

In GNU Emacs 27.0.50 (build 1, i386-apple-darwin10.8.0, NS appkit-1038.36 
Version 10.6.8 (Build 10K549))
 of 2018-08-25 built on bonbon
Repository revision: 161139a42c02cce051c51fb80c6ae00c9e6beaa6
Windowing system distributor 'Apple', version 10.3.1038
System Description:  Mac OS X 10.6.8

Recent messages:
Mark set [2 times]
Entering debugger...
Back to top level
s-< is undefined
C-x C-g is undefined
Mark set [2 times]
Mark saved where search started
Mark set

Configured using:
 'configure CC=gcc-4.2 CFLAGS=-fobjc-exceptions

Configured features:

Important settings:
  value of $LANG: de_DE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: C/*l

Minor modes in effect:
  diff-auto-refine-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Load-path shadows:
None found.

(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
mml-sec password-cache epa derived epg epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils misearch multi-isearch vc-git diff-mode
easy-mmode cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs thingatpt find-func help-fns radix-tree
cl-print debug backtrace help-mode easymenu cl-loaddefs cl-lib elec-pair
time-date tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind kqueue cocoa ns lcms2 multi-tty
make-network-process emacs)

Memory information:
((conses 8 238509 10624)
 (symbols 24 23285 1)
 (strings 16 38140 2495)
 (string-bytes 1 1151011)
 (vectors 12 40088)
 (vector-slots 4 878428 30532)
 (floats 8 55 214)
 (intervals 28 1547 405)
 (buffers 536 17))

‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)

reply via email to

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