From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: MON KEY Newsgroups: gmane.emacs.devel Subject: Removing non `loop' features from cl.el - `cl-map-overlays', `cl-map-intervals', `cl-map-extents' Date: Sat, 11 Dec 2010 17:48:47 -0500 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1292107743 23845 80.91.229.12 (11 Dec 2010 22:49:03 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 11 Dec 2010 22:49:03 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 11 23:48:59 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PRYFL-0006KF-EV for ged-emacs-devel@m.gmane.org; Sat, 11 Dec 2010 23:48:55 +0100 Original-Received: from localhost ([127.0.0.1]:52854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PRYFK-0001ta-T9 for ged-emacs-devel@m.gmane.org; Sat, 11 Dec 2010 17:48:54 -0500 Original-Received: from [140.186.70.92] (port=56579 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PRYFG-0001tV-PP for emacs-devel@gnu.org; Sat, 11 Dec 2010 17:48:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PRYFF-0007hh-Bs for emacs-devel@gnu.org; Sat, 11 Dec 2010 17:48:50 -0500 Original-Received: from mail-ww0-f49.google.com ([74.125.82.49]:42570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PRYFF-0007hZ-2v for emacs-devel@gnu.org; Sat, 11 Dec 2010 17:48:49 -0500 Original-Received: by wwb17 with SMTP id 17so4971747wwb.30 for ; Sat, 11 Dec 2010 14:48:47 -0800 (PST) Original-Received: by 10.216.156.84 with SMTP id l62mr2746166wek.58.1292107727201; Sat, 11 Dec 2010 14:48:47 -0800 (PST) Original-Received: by 10.216.70.212 with HTTP; Sat, 11 Dec 2010 14:48:47 -0800 (PST) X-Google-Sender-Auth: zUApy2A2zJJqBHHIv5pRs_qAd3g X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:133614 Archived-At: cl.el defines `cl-map-extents' as: (defun cl-map-extents (&rest cl-args) (apply 'cl-map-overlays cl-args)) AFAICT its only caller is the `loop' macro. Is there any reason why `cl-map-extents' shouldn't be defaliased to `cl-map-overlays'? Changelog circa 1999-12-18 says: (cl-map-extents): Remove compatibility code. Also, byte-compiling functions which use the `loop' macro to map overlays or "intervals" of a buffer causes the byte-compiler to warn spuriously about calling `cl-map-overlays' and `cl-map-intervals' at runtime. On GNU Emacs 23.2.1 when evaluating the form below: (let ((auto-save-default nil) (make-backup-files nil) (backup-inhibited nil)) (with-temp-file "./extent-interval-cmpl.el" (insert "\n\(eval-when-compile \(require 'cl\)\) \(defun %loop-interval-or-overlay \(&optional olay-or-interval\) \(case olay-or-interval \(overlay \(loop for ov being the overlays of \(current-buffer\) collecting ov\)\) \(interval \(loop for iv being the intervals of \(current-buffer\) collecting iv\)\)\)\) \(defun plain-old-loop \(\) \(loop for i from 0 to 10 collecting i\)\) \(provide 'extent-interval-cmpl\)\n")) (byte-compile-file "./extent-interval-cmpl.el") (delete-file "./extent-interval-cmpl.el") (delete-file "./extent-interval-cmpl.elc") (with-current-buffer (get-buffer-create "*Compile-Log*") (display-buffer (current-buffer) t))) Following is what *Compile-Log* has to say about things: ,---- | In %loop-interval-or-overlay: | extent-interval-cmpl.el:8:23:Warning: Function `cl-map-extents' from cl | package called at runtime | extent-interval-cmpl.el:10:16:Warning: assignment to free variable `iv' | extent-interval-cmpl.el:11:23:Warning: reference to free variable `iv' | extent-interval-cmpl.el:11:23:Warning: Function `cl-map-intervals' from cl | package called at runtime `---- Can anyone else confirm this behavior? Unless, I've somehow mucked up my cl-*.el files I find these warnings to be unbelievably bogus! There is nothing in `cl-map-overlays' nor `cl-map-intervals' which is specific to Common Lisp, and whatever compatibility code was in `cl-map-extents' has long since been removed. AFAIK none of these functions have ever been features provided by Common Lisp and aren't required for compatibility with Common Lisp. These were features _added_ by cl.el on top of the `loop' macro. Likewise, none of thes functions require use of CL style keywords so its not like there is anything which would suggest that the "cl-" namespacing is needed. Regardless it certainly shouldn't be causing the byte-compiler to issue warnings. My impression is that GNU Emacs' policy on use of `loop' macro is that top-level functions are allowed to contain loop forms without penalty of the byte-compiler signalling warnings about their expansion at compile-time. Disregarding whether the rationale behind this policy is entirely reasonable, it is more than a little hypocritical to enforce explicit constraints on how and when one may use a feature distributed _with_ Emacs core (inside the lisp/emacs-lisp directory) only to penalize users when they attempt to use some non-Common Lisp feature that Emacs strapped onto a Common Lisp compatibility library. Given the existing prejudiced policy regarding use of cl.el at runtime, TRT to do w/re these and any other similar such `loop' features not explictity provided for in the CL spec would be to: - remove them from the `loop' macro. IOW completely disallow the ability to map over buffer overlays and intervals, windows, frames, screens, buffers, etc. as none of thse are specific to Common Lisp either (cf Bug#7492 re mapping windows and minibuffer frames); - move `cl-map-overlays', `cl-map-intervals', and `cl-map-extents' into a different namespace; - subsitute some other non predjudiced procedure in place of `loop's use of `cl-map-overlays' and `cl-map-intervals'; - subsitute some other non predjudiece procedure in place of `loop's use of `cl-map-overlays' and `cl-map-intervals'; >From lisp/ in trunk current through bzr revision 102638 rgrep matches for: ;; cl-map-overlays: ./emacs-lisp/cl-extra.el:273:(defun cl-map-overlays (cl-func &optional cl-buffer cl-start cl-end cl-arg) ./emacs-lisp/cl-extra.el:314:(defalias 'cl-map-extents 'cl-map-overlays) ./emacs-lisp/cl-loaddefs.el:11:;;;;;; cl-map-overlays cl-map-intervals cl-map-keymap-recursively ./emacs-lisp/cl-loaddefs.el:96:(autoload 'cl-map-overlays "cl-extra" "\ ./ChangeLog.9:18443: (cl-map-overlays): Use with-current-buffer. ;; cl-map-intervals: ./emacs-lisp/cl-macs.el:940: `(cl-map-intervals ./emacs-lisp/cl-loaddefs.el:11:;;;;;; cl-map-overlays cl-map-intervals cl-map-keymap-recursively ./emacs-lisp/cl-loaddefs.el:91:(autoload 'cl-map-intervals "cl-extra" "\ ./ChangeLog.9:18441: (cl-map-intervals): Use with-current-buffer. Don't check for ;; cl-map-extents: ./emacs-lisp/cl-macs.el:915: `(cl-map-extents ./emacs-lisp/cl-extra.el:314:(defalias 'cl-map-extents 'cl-map-overlays) ./ChangeLog.8:268: (cl-map-extents): Remove compatibility code. -- /s_P\