From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Newsgroups: gmane.emacs.devel Subject: Re: Optimizations for flymake Date: Mon, 01 Nov 2004 19:17:13 -0500 Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1099354695 14383 80.91.229.6 (2 Nov 2004 00:18:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 2 Nov 2004 00:18:15 +0000 (UTC) Cc: Pavel Kobiakov , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 02 01:18:04 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 1COmNA-0005iU-00 for ; Tue, 02 Nov 2004 01:18:04 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1COmVB-0003nd-AE for ged-emacs-devel@m.gmane.org; Mon, 01 Nov 2004 19:26:21 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1COmUU-0003gX-G1 for emacs-devel@gnu.org; Mon, 01 Nov 2004 19:25:38 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1COmUS-0003fT-VI for emacs-devel@gnu.org; Mon, 01 Nov 2004 19:25:37 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1COmUS-0003fG-NI for emacs-devel@gnu.org; Mon, 01 Nov 2004 19:25:36 -0500 Original-Received: from [206.47.199.166] (helo=simmts8-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1COmMM-0004xp-Ta for emacs-devel@gnu.org; Mon, 01 Nov 2004 19:17:15 -0500 Original-Received: from empanada.home ([67.71.24.49]) by simmts8-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20041102001714.LLOD1692.simmts8-srv.bellnexxia.net@empanada.home>; Mon, 1 Nov 2004 19:17:14 -0500 Original-Received: by empanada.home (Postfix, from userid 502) id 06A3634FF92; Mon, 1 Nov 2004 19:17:13 -0500 (EST) Original-To: storm@cua.dk (Kim F. Storm) In-Reply-To: (Kim F. Storm's message of "Mon, 01 Nov 2004 23:37:59 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (darwin) 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: main.gmane.org gmane.emacs.devel:29283 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:29283 > ! (defsubst flymake-makehash(&optional test) > ! (if (featurep 'xemacs) > ! (if test (make-hash-table :test test) (make-hash-table)) > ! (makehash test))) Why not (if (fboundp 'make-hash-table) ...) ? > (defun flymake-float-time() > ! (if (featurep 'xemacs) > ! (let ((tm (current-time))) > ! (multiple-value-bind (s0 s1 s2) (current-time) > ! (+ (* (float (ash 1 16)) s0) (float s1) (* 0.0000001 s2)))) > ! (float-time))) Why not (if (fboundp 'float-time) ...) ? > ! (defsubst flymake-replace-regexp-in-string(regexp rep str) > ! (if (featurep 'xemacs) > ! (replace-in-string str regexp rep) > ! (replace-regexp-in-string regexp rep str))) Why not (if (fboundp 'replace-regexp-in-string) ...) ? I'd actually make it even more efficient than `defsubst': > ! (defsubst flymake-split-string(str pattern) > ! (if (featurep 'xemacs) > ! (flymake-split-string-remove-empty-edges str pattern) > ! (flymake-split-string-remove-empty-edges str pattern))) Hmmm... isn't this just (defalias 'flymake-split-string 'flymake-split-string-remove-empty-edges) ? > ! (defsubst flymake-get-temp-dir() > ! (if (featurep 'xemacs) > ! (temp-directory) > ! temporary-file-directory)) Why not (if (fboundp 'temp-directory) ...) ? > (defun flymake-popup-menu(pos menu-data) > ! (if (featurep 'xemacs) > ! (let* ((x-pos (nth 0 (nth 0 pos))) > ! (y-pos (nth 1 (nth 0 pos))) > ! (fake-event-props '(button 1 x 1 y 1))) > ! (setq fake-event-props (plist-put fake-event-props 'x x-pos)) > ! (setq fake-event-props (plist-put fake-event-props 'y y-pos)) > ! (popup-menu (flymake-make-xemacs-menu menu-data) (make-event 'button-press fake-event-props)) > ! ) > ! (x-popup-menu pos (flymake-make-emacs-menu menu-data)))) Since Emacs-21 has popup-menu, we should be able to throw away flymake-make-emacs-menu and rename flymake-make-xemacs-menu to flymake-make-menu: (defun flymake-popup-menu(pos menu-data) (popup-menu (flymake-make-menu menu-data) (if (not (featurep 'xemacs)) pos (let* ((x-pos (nth 0 (nth 0 pos))) (y-pos (nth 1 (nth 0 pos))) (fake-event-props '(button 1 x 1 y 1))) (setq fake-event-props (plist-put fake-event-props 'x x-pos)) (setq fake-event-props (plist-put fake-event-props 'y y-pos)) (make-event 'button-press fake-event-props))))) > (defun flymake-current-row() > "return current row in current frame" > ! (if (featurep 'xemacs) > ! (count-lines (window-start) (point)) > ! (+ (car (cdr (window-edges))) (count-lines (window-start) (point))))) I suspect this should be: (defun flymake-current-row() "return current row in current frame" (+ (count-lines (window-start) (point)) (if (fboundp 'window-edges) (car (cdr (window-edges))) ;; On XEmacs we should probably use something else, but what?? 0))) > ! (defsubst flymake-selected-frame() > ! (if (featurep 'xemacs) > ! (selected-window) > ! (selected-frame))) XEmacs has `selected-frame' as well, so the above code looks odd. I must be missing something. Stefan