emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109159: * lisp/emacs-lisp/chart.el:


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109159: * lisp/emacs-lisp/chart.el: Use lexical-binding.
Date: Thu, 19 Jul 2012 07:39:38 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109159
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Thu 2012-07-19 07:39:38 -0400
message:
  * lisp/emacs-lisp/chart.el: Use lexical-binding.
  (chart-emacs-storage): Don't hardcode the list of entries.
  * src/alloc.c (Fgarbage_collect): Tweak docstring.
modified:
  lisp/ChangeLog
  lisp/emacs-lisp/chart.el
  src/ChangeLog
  src/alloc.c
  src/xmenu.c
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-07-19 09:50:01 +0000
+++ b/lisp/ChangeLog    2012-07-19 11:39:38 +0000
@@ -1,3 +1,8 @@
+2012-07-19  Stefan Monnier  <address@hidden>
+
+       * emacs-lisp/chart.el: Use lexical-binding.
+       (chart-emacs-storage): Don't hardcode the list of entries.
+
 2012-07-19  Dmitry Antipov  <address@hidden>
 
        Next round of tweaks caused by Fgarbage_collect changes.

=== modified file 'lisp/emacs-lisp/chart.el'
--- a/lisp/emacs-lisp/chart.el  2012-07-19 09:50:01 +0000
+++ b/lisp/emacs-lisp/chart.el  2012-07-19 11:39:38 +0000
@@ -1,4 +1,4 @@
-;;; chart.el --- Draw charts (bar charts, etc)
+;;; chart.el --- Draw charts (bar charts, etc)  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1996, 1998-1999, 2001, 2004-2005, 2007-2012
 ;;   Free Software Foundation, Inc.
@@ -156,7 +156,7 @@
    )
   "Superclass for all charts to be displayed in an Emacs buffer.")
 
-(defmethod initialize-instance :AFTER ((obj chart) &rest fields)
+(defmethod initialize-instance :AFTER ((obj chart) &rest _fields)
   "Initialize the chart OBJ being created with FIELDS.
 Make sure the width/height is correct."
   (oset obj x-width (- (window-width) 10))
@@ -276,7 +276,7 @@
                       (float (- (cdr range) (car range)))))))))
   )
 
-(defmethod chart-axis-draw ((a chart-axis-range) &optional dir margin zone 
start end)
+(defmethod chart-axis-draw ((a chart-axis-range) &optional dir margin zone 
_start _end)
   "Draw axis information based upon a range to be spread along the edge.
 A is the chart to draw.  DIR is the direction.
 MARGIN, ZONE, START, and END specify restrictions in chart space."
@@ -329,7 +329,7 @@
          (+ m -1 (round (* lpn (+ 1.0 (float n))))))
     ))
 
-(defmethod chart-axis-draw ((a chart-axis-names) &optional dir margin zone 
start end)
+(defmethod chart-axis-draw ((a chart-axis-names) &optional dir margin zone 
_start _end)
   "Draw axis information based upon A range to be spread along the edge.
 Optional argument DIR is the direction of the chart.
 Optional arguments MARGIN, ZONE, START and END specify boundaries of the 
drawing."
@@ -675,32 +675,14 @@
 (defun chart-emacs-storage ()
   "Chart the current storage requirements of Emacs."
   (interactive)
-  (let* ((data (garbage-collect))
-        (cons-info (nth 0 data))
-        (symbol-info (nth 1 data))
-        (misc-info (nth 2 data))
-        (string-info (nth 3 data))
-        (string-bytes-info (nth 4 data))
-        ;; (nth 5 data) is not used
-        (vector-slots-info (nth 6 data))
-        (float-info (nth 7 data))
-        (interval-info (nth 8 data))
-        (buffer-info (nth 9 data))
-        (names '("conses" "symbols" "miscs" "strings"
-                 "vectors" "floats" "intervals" "buffers"))
-        (nums (list (* (nth 1 cons-info) (nth 2 cons-info))
-                    (* (nth 1 symbol-info) (nth 2 symbol-info))
-                    (* (nth 1 misc-info) (nth 2 misc-info))
-                    (+ (* (nth 1 string-info) (nth 2 string-info))
-                       (nth 2 string-bytes-info))
-                    (* (nth 1 vector-slots-info) (nth 2 vector-slots-info))
-                    (* (nth 1 float-info) (nth 2 float-info))
-                    (* (nth 1 interval-info) (nth 2 interval-info))
-                    (* (nth 1 buffer-info) (nth 2 buffer-info)))))
+  (let* ((data (garbage-collect)))
     ;; Let's create the chart!
     (chart-bar-quickie 'vertical "Emacs Runtime Storage Usage"
-                      names "Storage Items"
-                      nums "Objects")))
+                      (mapcar (lambda (x) (symbol-name (car x))) data)
+                       "Storage Items"
+                      (mapcar (lambda (x) (* (nth 1 x) (nth 2 x)))
+                               data)
+                       "Bytes")))
 
 (defun chart-emacs-lists ()
   "Chart out the size of various important lists."

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-19 09:50:01 +0000
+++ b/src/ChangeLog     2012-07-19 11:39:38 +0000
@@ -1,3 +1,7 @@
+2012-07-19  Stefan Monnier  <address@hidden>
+
+       * alloc.c (Fgarbage_collect): Tweak docstring.
+
 2012-07-19  Dmitry Antipov  <address@hidden>
 
        Tweak the value returned from Fgarbage_collect again.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-07-19 09:50:01 +0000
+++ b/src/alloc.c       2012-07-19 11:39:38 +0000
@@ -5378,17 +5378,14 @@
        doc: /* Reclaim storage for Lisp objects no longer needed.
 Garbage collection happens automatically if you cons more than
 `gc-cons-threshold' bytes of Lisp data since previous garbage collection.
-`garbage-collect' normally returns a list with info on amount of space in use:
- ((CONS INTERNAL-SIZE USED-CONSES FREE-CONSES)
-  (SYMBOL INTERNAL-SIZE USED-SYMBOLS FREE-SYMBOLS)
-  (MISC INTERNAL-SIZE USED-MISCS FREE-MISCS)
-  (STRING INTERNAL-SIZE USED-STRINGS FREE-STRING)
-  (STRING-BYTES 1 USED-STRING-BYTES)
-  (VECTOR INTERNAL-SIZE USED-VECTORS)
-  (VECTOR-SLOTS INTERNAL-SIZE USED-VECTOR-SLOTS FREE-VECTOR-SLOTS)
-  (FLOAT INTERNAL-SIZE USED-FLOATS FREE-FLOATS)
-  (INTERVAL INTERNAL-SIZE USED-INTERVALS FREE-INTERVALS)
-  (BUFFER INTERNAL-SIZE USED-BUFFERS))
+`garbage-collect' normally returns a list with info on amount of space in use,
+where each entry has the form (NAME SIZE USED FREE), where:
+- NAME is a symbol describing the kind of objects this entry represents,
+- SIZE is the number of bytes used by each one,
+- USED is the number of those objects that were found live in the heap,
+- FREE is the number of those objects that are not live but that Emacs
+  keeps around for future allocations (maybe because it does not know how
+  to return them to the OS).
 However, if there was overflow in pure space, `garbage-collect'
 returns nil, because real GC can't be done.
 See Info node `(elisp)Garbage Collection'.  */)

=== modified file 'src/xmenu.c'
--- a/src/xmenu.c       2012-07-11 07:19:44 +0000
+++ b/src/xmenu.c       2012-07-19 11:39:38 +0000
@@ -679,19 +679,17 @@
 /* This callback is invoked when a dialog or menu is finished being
    used and has been unposted.  */
 
+static void
+popup_deactivate_callback (
 #ifdef USE_GTK
-static void
-popup_deactivate_callback (GtkWidget *widget, gpointer client_data)
-{
-  popup_activated_flag = 0;
-}
+                          GtkWidget *widget, gpointer client_data
 #else
-static void
-popup_deactivate_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
-{
-  popup_activated_flag = 0;
-}
+                          Widget widget, LWLIB_ID id, XtPointer client_data
 #endif
+                          )
+{
+  popup_activated_flag = 0;
+}
 
 
 /* Function that finds the frame for WIDGET and shows the HELP text


reply via email to

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