Commit 5db81e33 authored by Stefan Monnier's avatar Stefan Monnier

* 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.
parent 5b835e1d
2012-07-19 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/chart.el: Use lexical-binding.
(chart-emacs-storage): Don't hardcode the list of entries.
2012-07-19 Dmitry Antipov <dmantipov@yandex.ru>
Next round of tweaks caused by Fgarbage_collect changes.
......
;;; 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 @@ Returns the newly created buffer."
)
"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 @@ START and END represent the boundary."
(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 @@ Automatically compensates for direction."
(+ 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 @@ SORT-PRED if desired."
(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."
......
2012-07-19 Stefan Monnier <monnier@iro.umontreal.ca>
* alloc.c (Fgarbage_collect): Tweak docstring.
2012-07-19 Dmitry Antipov <dmantipov@yandex.ru>
Tweak the value returned from Fgarbage_collect again.
......
......@@ -5378,17 +5378,14 @@ DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "",
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'. */)
......
......@@ -679,19 +679,17 @@ popup_activate_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
/* This callback is invoked when a dialog or menu is finished being
used and has been unposted. */
#ifdef USE_GTK
static void
popup_deactivate_callback (GtkWidget *widget, gpointer client_data)
{
popup_activated_flag = 0;
}
popup_deactivate_callback (
#ifdef USE_GTK
GtkWidget *widget, gpointer client_data
#else
static void
popup_deactivate_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
Widget widget, LWLIB_ID id, XtPointer client_data
#endif
)
{
popup_activated_flag = 0;
}
#endif
/* Function that finds the frame for WIDGET and shows the HELP text
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment