diff options
| author | Stefan Monnier | 2012-07-19 07:39:38 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2012-07-19 07:39:38 -0400 |
| commit | 5db81e33629049da22e7d0ff6c28a5cae31edac9 (patch) | |
| tree | a30274d3c351832f8ed0baacd2d178bd0e0fe93c | |
| parent | 5b835e1d6e0c6fafc7f27174889358bfde5f2449 (diff) | |
| download | emacs-5db81e33629049da22e7d0ff6c28a5cae31edac9.tar.gz emacs-5db81e33629049da22e7d0ff6c28a5cae31edac9.zip | |
* 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.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/chart.el | 38 | ||||
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/alloc.c | 19 | ||||
| -rw-r--r-- | src/xmenu.c | 14 |
5 files changed, 33 insertions, 47 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 12186c7bef7..170982d724e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-07-19 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * emacs-lisp/chart.el: Use lexical-binding. | ||
| 4 | (chart-emacs-storage): Don't hardcode the list of entries. | ||
| 5 | |||
| 1 | 2012-07-19 Dmitry Antipov <dmantipov@yandex.ru> | 6 | 2012-07-19 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 7 | ||
| 3 | Next round of tweaks caused by Fgarbage_collect changes. | 8 | Next round of tweaks caused by Fgarbage_collect changes. |
diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el index 1451e1a2af4..31aeb1f8076 100644 --- a/lisp/emacs-lisp/chart.el +++ b/lisp/emacs-lisp/chart.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; chart.el --- Draw charts (bar charts, etc) | 1 | ;;; chart.el --- Draw charts (bar charts, etc) -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1996, 1998-1999, 2001, 2004-2005, 2007-2012 | 3 | ;; Copyright (C) 1996, 1998-1999, 2001, 2004-2005, 2007-2012 |
| 4 | ;; Free Software Foundation, Inc. | 4 | ;; Free Software Foundation, Inc. |
| @@ -156,7 +156,7 @@ Returns the newly created buffer." | |||
| 156 | ) | 156 | ) |
| 157 | "Superclass for all charts to be displayed in an Emacs buffer.") | 157 | "Superclass for all charts to be displayed in an Emacs buffer.") |
| 158 | 158 | ||
| 159 | (defmethod initialize-instance :AFTER ((obj chart) &rest fields) | 159 | (defmethod initialize-instance :AFTER ((obj chart) &rest _fields) |
| 160 | "Initialize the chart OBJ being created with FIELDS. | 160 | "Initialize the chart OBJ being created with FIELDS. |
| 161 | Make sure the width/height is correct." | 161 | Make sure the width/height is correct." |
| 162 | (oset obj x-width (- (window-width) 10)) | 162 | (oset obj x-width (- (window-width) 10)) |
| @@ -276,7 +276,7 @@ START and END represent the boundary." | |||
| 276 | (float (- (cdr range) (car range))))))))) | 276 | (float (- (cdr range) (car range))))))))) |
| 277 | ) | 277 | ) |
| 278 | 278 | ||
| 279 | (defmethod chart-axis-draw ((a chart-axis-range) &optional dir margin zone start end) | 279 | (defmethod chart-axis-draw ((a chart-axis-range) &optional dir margin zone _start _end) |
| 280 | "Draw axis information based upon a range to be spread along the edge. | 280 | "Draw axis information based upon a range to be spread along the edge. |
| 281 | A is the chart to draw. DIR is the direction. | 281 | A is the chart to draw. DIR is the direction. |
| 282 | MARGIN, ZONE, START, and END specify restrictions in chart space." | 282 | MARGIN, ZONE, START, and END specify restrictions in chart space." |
| @@ -329,7 +329,7 @@ Automatically compensates for direction." | |||
| 329 | (+ m -1 (round (* lpn (+ 1.0 (float n)))))) | 329 | (+ m -1 (round (* lpn (+ 1.0 (float n)))))) |
| 330 | )) | 330 | )) |
| 331 | 331 | ||
| 332 | (defmethod chart-axis-draw ((a chart-axis-names) &optional dir margin zone start end) | 332 | (defmethod chart-axis-draw ((a chart-axis-names) &optional dir margin zone _start _end) |
| 333 | "Draw axis information based upon A range to be spread along the edge. | 333 | "Draw axis information based upon A range to be spread along the edge. |
| 334 | Optional argument DIR is the direction of the chart. | 334 | Optional argument DIR is the direction of the chart. |
| 335 | Optional arguments MARGIN, ZONE, START and END specify boundaries of the drawing." | 335 | Optional arguments MARGIN, ZONE, START and END specify boundaries of the drawing." |
| @@ -675,32 +675,14 @@ SORT-PRED if desired." | |||
| 675 | (defun chart-emacs-storage () | 675 | (defun chart-emacs-storage () |
| 676 | "Chart the current storage requirements of Emacs." | 676 | "Chart the current storage requirements of Emacs." |
| 677 | (interactive) | 677 | (interactive) |
| 678 | (let* ((data (garbage-collect)) | 678 | (let* ((data (garbage-collect))) |
| 679 | (cons-info (nth 0 data)) | ||
| 680 | (symbol-info (nth 1 data)) | ||
| 681 | (misc-info (nth 2 data)) | ||
| 682 | (string-info (nth 3 data)) | ||
| 683 | (string-bytes-info (nth 4 data)) | ||
| 684 | ;; (nth 5 data) is not used | ||
| 685 | (vector-slots-info (nth 6 data)) | ||
| 686 | (float-info (nth 7 data)) | ||
| 687 | (interval-info (nth 8 data)) | ||
| 688 | (buffer-info (nth 9 data)) | ||
| 689 | (names '("conses" "symbols" "miscs" "strings" | ||
| 690 | "vectors" "floats" "intervals" "buffers")) | ||
| 691 | (nums (list (* (nth 1 cons-info) (nth 2 cons-info)) | ||
| 692 | (* (nth 1 symbol-info) (nth 2 symbol-info)) | ||
| 693 | (* (nth 1 misc-info) (nth 2 misc-info)) | ||
| 694 | (+ (* (nth 1 string-info) (nth 2 string-info)) | ||
| 695 | (nth 2 string-bytes-info)) | ||
| 696 | (* (nth 1 vector-slots-info) (nth 2 vector-slots-info)) | ||
| 697 | (* (nth 1 float-info) (nth 2 float-info)) | ||
| 698 | (* (nth 1 interval-info) (nth 2 interval-info)) | ||
| 699 | (* (nth 1 buffer-info) (nth 2 buffer-info))))) | ||
| 700 | ;; Let's create the chart! | 679 | ;; Let's create the chart! |
| 701 | (chart-bar-quickie 'vertical "Emacs Runtime Storage Usage" | 680 | (chart-bar-quickie 'vertical "Emacs Runtime Storage Usage" |
| 702 | names "Storage Items" | 681 | (mapcar (lambda (x) (symbol-name (car x))) data) |
| 703 | nums "Objects"))) | 682 | "Storage Items" |
| 683 | (mapcar (lambda (x) (* (nth 1 x) (nth 2 x))) | ||
| 684 | data) | ||
| 685 | "Bytes"))) | ||
| 704 | 686 | ||
| 705 | (defun chart-emacs-lists () | 687 | (defun chart-emacs-lists () |
| 706 | "Chart out the size of various important lists." | 688 | "Chart out the size of various important lists." |
diff --git a/src/ChangeLog b/src/ChangeLog index 517d61c4e40..8a60e0bdabe 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2012-07-19 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * alloc.c (Fgarbage_collect): Tweak docstring. | ||
| 4 | |||
| 1 | 2012-07-19 Dmitry Antipov <dmantipov@yandex.ru> | 5 | 2012-07-19 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 6 | ||
| 3 | Tweak the value returned from Fgarbage_collect again. | 7 | Tweak the value returned from Fgarbage_collect again. |
diff --git a/src/alloc.c b/src/alloc.c index c52b0475352..d24787576e9 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -5378,17 +5378,14 @@ DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "", | |||
| 5378 | doc: /* Reclaim storage for Lisp objects no longer needed. | 5378 | doc: /* Reclaim storage for Lisp objects no longer needed. |
| 5379 | Garbage collection happens automatically if you cons more than | 5379 | Garbage collection happens automatically if you cons more than |
| 5380 | `gc-cons-threshold' bytes of Lisp data since previous garbage collection. | 5380 | `gc-cons-threshold' bytes of Lisp data since previous garbage collection. |
| 5381 | `garbage-collect' normally returns a list with info on amount of space in use: | 5381 | `garbage-collect' normally returns a list with info on amount of space in use, |
| 5382 | ((CONS INTERNAL-SIZE USED-CONSES FREE-CONSES) | 5382 | where each entry has the form (NAME SIZE USED FREE), where: |
| 5383 | (SYMBOL INTERNAL-SIZE USED-SYMBOLS FREE-SYMBOLS) | 5383 | - NAME is a symbol describing the kind of objects this entry represents, |
| 5384 | (MISC INTERNAL-SIZE USED-MISCS FREE-MISCS) | 5384 | - SIZE is the number of bytes used by each one, |
| 5385 | (STRING INTERNAL-SIZE USED-STRINGS FREE-STRING) | 5385 | - USED is the number of those objects that were found live in the heap, |
| 5386 | (STRING-BYTES 1 USED-STRING-BYTES) | 5386 | - FREE is the number of those objects that are not live but that Emacs |
| 5387 | (VECTOR INTERNAL-SIZE USED-VECTORS) | 5387 | keeps around for future allocations (maybe because it does not know how |
| 5388 | (VECTOR-SLOTS INTERNAL-SIZE USED-VECTOR-SLOTS FREE-VECTOR-SLOTS) | 5388 | to return them to the OS). |
| 5389 | (FLOAT INTERNAL-SIZE USED-FLOATS FREE-FLOATS) | ||
| 5390 | (INTERVAL INTERNAL-SIZE USED-INTERVALS FREE-INTERVALS) | ||
| 5391 | (BUFFER INTERNAL-SIZE USED-BUFFERS)) | ||
| 5392 | However, if there was overflow in pure space, `garbage-collect' | 5389 | However, if there was overflow in pure space, `garbage-collect' |
| 5393 | returns nil, because real GC can't be done. | 5390 | returns nil, because real GC can't be done. |
| 5394 | See Info node `(elisp)Garbage Collection'. */) | 5391 | See Info node `(elisp)Garbage Collection'. */) |
diff --git a/src/xmenu.c b/src/xmenu.c index 61e3e3632b0..c7ec3dc3171 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -679,19 +679,17 @@ popup_activate_callback (Widget widget, LWLIB_ID id, XtPointer client_data) | |||
| 679 | /* This callback is invoked when a dialog or menu is finished being | 679 | /* This callback is invoked when a dialog or menu is finished being |
| 680 | used and has been unposted. */ | 680 | used and has been unposted. */ |
| 681 | 681 | ||
| 682 | #ifdef USE_GTK | ||
| 683 | static void | 682 | static void |
| 684 | popup_deactivate_callback (GtkWidget *widget, gpointer client_data) | 683 | popup_deactivate_callback ( |
| 685 | { | 684 | #ifdef USE_GTK |
| 686 | popup_activated_flag = 0; | 685 | GtkWidget *widget, gpointer client_data |
| 687 | } | ||
| 688 | #else | 686 | #else |
| 689 | static void | 687 | Widget widget, LWLIB_ID id, XtPointer client_data |
| 690 | popup_deactivate_callback (Widget widget, LWLIB_ID id, XtPointer client_data) | 688 | #endif |
| 689 | ) | ||
| 691 | { | 690 | { |
| 692 | popup_activated_flag = 0; | 691 | popup_activated_flag = 0; |
| 693 | } | 692 | } |
| 694 | #endif | ||
| 695 | 693 | ||
| 696 | 694 | ||
| 697 | /* Function that finds the frame for WIDGET and shows the HELP text | 695 | /* Function that finds the frame for WIDGET and shows the HELP text |