From unknown Mon Jun 23 13:15:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18845: 24.4; cc-mode derived modes broken because cl is used but not required Resent-From: Joris Steyn Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Oct 2014 22:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18845 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 18845@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.141436134925887 (code B ref -1); Sun, 26 Oct 2014 22:10:02 +0000 Received: (at submit) by debbugs.gnu.org; 26 Oct 2014 22:09:09 +0000 Received: from localhost ([127.0.0.1]:36238 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XiVzo-0006jR-8b for submit@debbugs.gnu.org; Sun, 26 Oct 2014 18:09:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60267) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XiVtj-0006aP-EK for submit@debbugs.gnu.org; Sun, 26 Oct 2014 18:02:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XiVtc-0006Ao-Nv for submit@debbugs.gnu.org; Sun, 26 Oct 2014 18:02:46 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:50702) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiVtc-0006Ai-Ki for submit@debbugs.gnu.org; Sun, 26 Oct 2014 18:02:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiVta-00017L-Oi for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 18:02:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XiVtZ-0006AD-1N for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 18:02:42 -0400 Received: from mail-ig0-x231.google.com ([2607:f8b0:4001:c05::231]:62021) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiVtY-00069m-JN for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 18:02:40 -0400 Received: by mail-ig0-f177.google.com with SMTP id h18so1925228igc.10 for ; Sun, 26 Oct 2014 15:02:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=lZCL1WFVHw8EMcRGPE996ps9TT4yQ1dQvcedyU7WXIE=; b=d9JFruqfFlEzf49L4tTgapuSI2ZMHO0OVTsRUxZ+zQpHzbqwMQzb1l3lO05Pl6nHms trcC+xK8XiZcVhYSucbtyCKQlDnZ/ErFEc732/PCRsqTHHdhaMwHmWhEWLyRWudKznre 6dGbkCmc1ZWDXTS9pKJkw3Ub3Dgvga7jrFLFNX3wF4wKXu3ZbQYFOUrVJtJrsv6FtdJN AVYbzMPY1UEvfZi1T4rejTvqegVEtp9ZiW6MhDVkwPnN+zRMxunO8sm11dFg9H8rquPy kOV27Lk7dN67L9FSSl3YYrIwJOVnOhYEI63hEl4BDa561rTRRwsW6j1pPlQ6WQAIbHMe uIRQ== MIME-Version: 1.0 X-Received: by 10.107.3.101 with SMTP id 98mr18337557iod.25.1414360958548; Sun, 26 Oct 2014 15:02:38 -0700 (PDT) Received: by 10.107.45.215 with HTTP; Sun, 26 Oct 2014 15:02:38 -0700 (PDT) Date: Sun, 26 Oct 2014 23:02:38 +0100 Message-ID: From: Joris Steyn Content-Type: multipart/alternative; boundary=001a113ed20e84c1a905065a92c4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Mailman-Approved-At: Sun, 26 Oct 2014 18:09:06 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --001a113ed20e84c1a905065a92c4 Content-Type: text/plain; charset=UTF-8 cc-mode in emacs 24.4 uses the cl compatibility package at compile-time but does not require it when used like this: (require 'cc-mode) (eval-when-compile (require 'cc-langs)) ; Symbol's function definition is void: set-difference (c-lang-const c-matchers-2 c) ; Symbol's function definition is void: cl-macroexpand-all (c-lang-defconst c-other-kwds t nil) I observed breakage of php-mode and csharp-mode, but this affects any derived mode that does not require cl or requires cl-lib instead of cl. This seems to be recently fixed in trunk (revno 118032) so maybe no further action is required and this bug report can be closed. What would be the most appropriate way for affected derived modes to work around this issue? Suppose I add: (eval-when-compile (if (and (= emacs-major-version 24) (= emacs-minor-version 4)) (require 'cl))) would that be fine and won't there be a future 24.4 release that fixes this issue? In GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.3) of 2014-10-21 on bitzer.hoetzel.info Windowing system distributor `The X.Org Foundation', version 11.0.11601000 System Description: Arch Linux Configured using: `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --with-x-toolkit=gtk3 --with-xft 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro' Important settings: value of $LANG: C locale-coding-system: nil Major mode: Lisp Interaction Minor modes in effect: tooltip-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 Recent input: M-x r e p o r Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Making completion list... Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils help-mode easymenu time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer 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 make-network-process dbusbind gfilenotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) Memory information: ((conses 16 72116 7225) (symbols 48 17651 0) (miscs 40 37 96) (strings 32 9247 4331) (string-bytes 1 253012) (vectors 16 8990) (vector-slots 8 383789 17145) (floats 8 64 304) (intervals 56 210 111) (buffers 960 12) (heap 1024 26191 1090)) --001a113ed20e84c1a905065a92c4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
cc-mode in emacs 24.4 uses the cl compatibility packa= ge at compile-time
but does not require it when used like this:

= =C2=A0 (require 'cc-mode)

=C2=A0 (eval-when-compile
=C2=A0=C2= =A0=C2=A0 (require 'cc-langs))

=C2=A0 ; Symbol's function de= finition is void: set-difference
=C2=A0 (c-lang-const c-matchers-2 c)
=C2=A0 ; Symbol's function definition is void: cl-macroexpand-all<= br>=C2=A0 (c-lang-defconst c-other-kwds t nil)

I observed breakage o= f php-mode and csharp-mode, but this affects any
derived mode that does = not require cl or requires cl-lib instead of cl.

This seems to be re= cently fixed in trunk (revno 118032) so maybe no
further action is requi= red and this bug report can be closed.

What would be the most approp= riate way for affected derived modes to
work around this issue? Suppose = I add:

=C2=A0 (eval-when-compile
=C2=A0=C2=A0=C2=A0 (if (and (=3D= emacs-major-version 24) (=3D emacs-minor-version 4))
=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 (require 'cl)))

would that be fine and won't th= ere be a future 24.4 release that fixes
this issue?



In GN= U Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.3)
=C2=A0of = 2014-10-21 on bitzer.hoetzel.info
Windowing system distributor `The X.Org Foundation', version 11.0.= 11601000
System Description:=C2=A0=C2=A0=C2=A0 Arch Linux

Configu= red using:
=C2=A0`configure --prefix=3D/usr --sysconfdir=3D/etc --libexe= cdir=3D/usr/lib
=C2=A0--localstatedir=3D/var --with-x-toolkit=3Dgtk3 --w= ith-xft
=C2=A0'CFLAGS=3D-march=3Dx86-64 -mtune=3Dgeneric -O2 -pipe -= fstack-protector-strong
=C2=A0--param=3Dssp-buffer-size=3D4' CPPFLAG= S=3D-D_FORTIFY_SOURCE=3D2
=C2=A0LDFLAGS=3D-Wl,-O1,--sort-common,--as-nee= ded,-z,relro'

Important settings:
=C2=A0 value of $LANG: C=C2=A0 locale-coding-system: nil

Major mode: Lisp Interaction
Minor modes in effect:
=C2=A0 tooltip-mode: t
=C2=A0 electric-inden= t-mode: t
=C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mode: t
=C2= =A0 menu-bar-mode: t
=C2=A0 file-name-shadow-mode: t
=C2=A0 global-fo= nt-lock-mode: t
=C2=A0 font-lock-mode: t
=C2=A0 blink-cursor-mode: t<= br>=C2=A0 auto-composition-mode: t
=C2=A0 auto-encryption-mode: t
=C2= =A0 auto-compression-mode: t
=C2=A0 line-number-mode: t
=C2=A0 transi= ent-mark-mode: t

Recent input:
M-x r e p o <tab> r <tab&= gt; <return>

Recent messages:
For information about GNU Ema= cs and the GNU system, type C-h C-a.
Making completion list...

Lo= ad-path shadows:
None found.

Features:
(shadow sort gnus-util = mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-b= odies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendm= ail rfc2047 rfc2045 ietf-drums mm-util
help-fns mail-prsvr mail-utils he= lp-mode easymenu time-date tooltip
electric uniquify ediff-hook vc-hooks= lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image regexp-op= t fringe tabulated-list newcomment
lisp-mode prog-mode register page men= u-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock synta= x facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese= tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak = czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-= cmpr-hook help simple
abbrev minibuffer nadvice loaddefs button faces cu= s-face macroexp files
text-properties overlay sha1 md5 base64 format env= code-pages mule
custom widget hashtable-print-readable backquote make-n= etwork-process
dbusbind gfilenotify dynamic-setting system-font-setting<= br>font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)
Memory information:
((conses 16 72116 7225)
=C2=A0(symbols 48 17651 = 0)
=C2=A0(miscs 40 37 96)
=C2=A0(strings 32 9247 4331)
=C2=A0(stri= ng-bytes 1 253012)
=C2=A0(vectors 16 8990)
=C2=A0(vector-slots 8 3837= 89 17145)
=C2=A0(floats 8 64 304)
=C2=A0(intervals 56 210 111)
=C2= =A0(buffers 960 12)
=C2=A0(heap 1024 26191 1090))

--001a113ed20e84c1a905065a92c4-- From unknown Mon Jun 23 13:15:17 2025 X-Loop: help-debbugs@gnu.org Subject: bug#18845: 24.4; cc-mode derived modes broken because cl is used but not required Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Thu, 30 Oct 2014 03:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18845 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Joris Steyn Cc: 18845@debbugs.gnu.org X-Debbugs-Original-Cc: bug-cc-mode@gnu.org, 18845@debbugs.gnu.org Received: via spool by 18845-submit@debbugs.gnu.org id=B18845.141464127710941 (code B ref 18845); Thu, 30 Oct 2014 03:55:02 +0000 Received: (at 18845) by debbugs.gnu.org; 30 Oct 2014 03:54:37 +0000 Received: from localhost ([127.0.0.1]:39625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xjgom-0002qO-GE for submit@debbugs.gnu.org; Wed, 29 Oct 2014 23:54:36 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:20631) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xjgok-0002q9-Px for 18845@debbugs.gnu.org; Wed, 29 Oct 2014 23:54:35 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvAMAOatTlRFpY87/2dsb2JhbABcgw6DYoZ+yDmDGgQCAoEcFwEBfIQDAQEDAVYjBQsLNBIUGA0kiEsJy3IBAQEBAQEEAQEBAR6RCAeESwWyIIFvgjSBYCGCegEBAQ X-IPAS-Result: AvAMAOatTlRFpY87/2dsb2JhbABcgw6DYoZ+yDmDGgQCAoEcFwEBfIQDAQEDAVYjBQsLNBIUGA0kiEsJy3IBAQEBAQEEAQEBAR6RCAeESwWyIIFvgjSBYCGCegEBAQ X-IronPort-AV: E=Sophos;i="5.04,797,1406606400"; d="scan'208";a="95561675" Received: from 69-165-143-59.dsl.teksavvy.com (HELO pastel.home) ([69.165.143.59]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 29 Oct 2014 23:54:28 -0400 Received: by pastel.home (Postfix, from userid 20848) id 6657B7CFF; Wed, 29 Oct 2014 23:54:28 -0400 (EDT) From: Stefan Monnier Message-ID: References: Date: Wed, 29 Oct 2014 23:54:28 -0400 In-Reply-To: (Joris Steyn's message of "Sun, 26 Oct 2014 23:02:38 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > ; Symbol's function definition is void: set-difference > (c-lang-const c-matchers-2 c) Indeed. One way to solve these problems is to replace those calls with calls to cl-set-difference. Alan, what do you think? > ; Symbol's function definition is void: cl-macroexpand-all > (c-lang-defconst c-other-kwds t nil) I fixed this one with the patch below, > (eval-when-compile > (if (and (= emacs-major-version 24) (= emacs-minor-version 4)) > (require 'cl))) It's pretty ugly, but yes that should work. > would that be fine and won't there be a future 24.4 release that fixes > this issue? The 24.4 release is over, so no there won't be another 24.4. And hopefully this will be fixed in 24.5. Stefan === modified file 'lisp/progmodes/cc-defs.el' --- lisp/progmodes/cc-defs.el 2014-02-09 12:34:25 +0000 +++ lisp/progmodes/cc-defs.el 2014-10-30 03:46:48 +0000 @@ -169,6 +169,10 @@ (put 'cc-eval-when-compile 'lisp-indent-hook 0)) +(eval-and-compile + (defalias 'c--macroexpand-all + (if (fboundp 'macroexpand-all) + 'macroexpand-all 'cl-macroexpand-all))) ;;; Macros. @@ -1834,12 +1838,9 @@ immediately, i.e. at the same time as the `c-lang-defconst' form itself is evaluated." ;; Evaluate at macro expansion time, i.e. in the - ;; `cl-macroexpand-all' inside `c-lang-defconst'. + ;; `c--macroexpand-all' inside `c-lang-defconst'. (eval form)) -;; Only used at compile time - suppress "might not be defined at runtime". -(declare-function cl-macroexpand-all "cl" (form &optional env)) - (defmacro c-lang-defconst (name &rest args) "Set the language specific values of the language constant NAME. The second argument can optionally be a docstring. The rest of the @@ -1881,7 +1882,7 @@ (let* ((sym (intern (symbol-name name) c-lang-constants)) ;; Make `c-lang-const' expand to a straightforward call to - ;; `c-get-lang-constant' in `cl-macroexpand-all' below. + ;; `c-get-lang-constant' in `c--macroexpand-all' below. ;; ;; (The default behavior, i.e. to expand to a call inside ;; `eval-when-compile' should be equivalent, since that macro @@ -1944,7 +1945,7 @@ ;; reason, but we also use this expansion handle ;; `c-lang-defconst-eval-immediately' and to register ;; dependencies on the `c-lang-const's in VAL.) - (setq val (cl-macroexpand-all val)) + (setq val (c--macroexpand-all val)) (setq bindings (cons (cons assigned-mode val) bindings) args (cdr args)))) === modified file 'lisp/progmodes/cc-langs.el' --- lisp/progmodes/cc-langs.el 2014-06-14 23:54:39 +0000 +++ lisp/progmodes/cc-langs.el 2014-10-30 03:47:12 +0000 @@ -213,7 +213,6 @@ ;; These are defined in cl as aliases to the cl- versions. ;(declare-function delete-duplicates "cl-seq" (cl-seq &rest cl-keys) t) ;(declare-function mapcan "cl-extra" (cl-func cl-seq &rest cl-rest) t) -;(declare-function cl-macroexpand-all "cl" (form &optional env)) (eval-and-compile ;; Some helper functions used when building the language constants. @@ -3183,7 +3182,7 @@ `(lambda () ;; This let sets up the context for `c-mode-var' and similar - ;; that could be in the result from `cl-macroexpand-all'. + ;; that could be in the result from `c--macroexpand-all'. (let ((c-buffer-is-cc-mode ',mode) current-var source-eval) (c-make-emacs-variables-local) @@ -3193,12 +3192,12 @@ (setq ,@(let ((c-buffer-is-cc-mode mode) (c-lang-const-expansion 'immediate)) ;; `c-lang-const' will expand to the evaluated - ;; constant immediately in `cl-macroexpand-all' + ;; constant immediately in `c--macroexpand-all' ;; below. (cl-mapcan (lambda (init) `(current-var ',(car init) - ,(car init) ,(macroexpand-all + ,(car init) ,(c--macroexpand-all (elt init 1)))) ;; Note: The following `append' copies the ;; first argument. That list is small, so From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 17 14:12:42 2015 Received: (at control) by debbugs.gnu.org; 17 Feb 2015 19:12:42 +0000 Received: from localhost ([127.0.0.1]:46561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YNnZZ-0001LT-O4 for submit@debbugs.gnu.org; Tue, 17 Feb 2015 14:12:41 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:43553 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YNnZX-0001LL-IW for control@debbugs.gnu.org; Tue, 17 Feb 2015 14:12:39 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1YNnZX-0005i3-99 for control@debbugs.gnu.org; Tue, 17 Feb 2015 14:12:39 -0500 Date: Tue, 17 Feb 2015 14:12:39 -0500 Message-Id: Subject: control message for bug 18845 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) close 18845 24.5