Mercurial > hg > xemacs-beta
changeset 5214:0b4d355771bd
Import buffer-display-count, buffer-display-time; thank you, Jeff Sparkes.
man/ChangeLog addition:
2010-05-17 Jeff Sparkes <jsparkes@gmail.com>
* lispref/windows.texi (Buffers and Windows):
Document buffer-display-count and buffer-display-time with
descriptions from GNU emacs lispref.
* lispref/locals.texi (Standard Buffer-Local Variables):
Add buffer-display-count and buffer-display-time.
src/ChangeLog addition:
2010-05-17 Jeff Sparkes <jsparkes@gmail.com>
* buffer.c (complex_vars_of_buffer):
Add buffer local variables buffer-display-count and
buffer-display-time.
(common_init_complex_vars_of_buffer):
Initialize them here.
* bufslots.h: Add slots for buffer-display-count and buffer-display-time.
* window.c (Fset_window_buffer): Update buffer-display-count and
buffer-display-time whenever a buffer is displayed.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Fri, 28 May 2010 13:48:22 +0100 |
parents | 7abb91db1e64 |
children | 956d54c39176 |
files | man/ChangeLog man/lispref/locals.texi man/lispref/windows.texi src/ChangeLog src/buffer.c src/bufslots.h src/lisp.h src/window.c |
diffstat | 8 files changed, 70 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/man/ChangeLog Mon May 24 10:43:29 2010 +0200 +++ b/man/ChangeLog Fri May 28 13:48:22 2010 +0100 @@ -1,3 +1,12 @@ +2010-05-17 Jeff Sparkes <jsparkes@gmail.com> + + * lispref/windows.texi (Buffers and Windows): + Document buffer-display-count and buffer-display-time with + descriptions from GNU emacs lispref. + + * lispref/locals.texi (Standard Buffer-Local Variables): + Add buffer-display-count and buffer-display-time. + 2010-04-03 Aidan Kehoe <kehoea@parhasard.net> * lispref/hash-tables.texi (Introduction to Hash Tables):
--- a/man/lispref/locals.texi Mon May 24 10:43:29 2010 +0200 +++ b/man/lispref/locals.texi Fri May 28 13:48:22 2010 +0100 @@ -25,9 +25,15 @@ @item buffer-backed-up @pxref{Backup Files} +@item buffer-display-count +@xref{Buffers and Windows}. + @item buffer-display-table @pxref{Display Tables} +@item buffer-display-time +@xref{Buffers and Windows}. + @item buffer-file-format @pxref{Format Conversion}
--- a/man/lispref/windows.texi Mon May 24 10:43:29 2010 +0200 +++ b/man/lispref/windows.texi Fri May 28 13:48:22 2010 +0100 @@ -705,6 +705,12 @@ @end example @end defun +@defvar buffer-display-count +This buffer-local variable records the number of times a buffer has been +displayed in a window. It is incremented each time +@code{set-window-buffer} is called for the buffer. +@end defvar + @defun window-buffer &optional window This function returns the buffer that @var{window} is displaying. If @var{window} is omitted, this function returns the buffer for the @@ -729,6 +735,16 @@ the same meaning as for @code{next-window}. @end defun + +@defvar buffer-display-time +This variable records the time at which a buffer was last made visible +in a window. It is always local in each buffer; each time +@code{set-window-buffer} is called, it sets this variable to +@code{(current-time)} in the specified buffer (@pxref{Time of Day}). +When a buffer is first created, @code{buffer-display-time} starts out +with the value @code{nil}. +@end defvar + @node Displaying Buffers @section Displaying Buffers in Windows @cindex switching to a buffer
--- a/src/ChangeLog Mon May 24 10:43:29 2010 +0200 +++ b/src/ChangeLog Fri May 28 13:48:22 2010 +0100 @@ -3,6 +3,19 @@ * lread.c (read1): Accept #B<binary>, #O<octal>, and #X<hex>, just like GNU Emacs. +2010-05-17 Jeff Sparkes <jsparkes@gmail.com> + + * buffer.c (complex_vars_of_buffer): + Add buffer local variables buffer-display-count and + buffer-display-time. + (common_init_complex_vars_of_buffer): + Initialize them here. + + * bufslots.h: Add slots for buffer-display-count and buffer-display-time. + + * window.c (Fset_window_buffer): Update buffer-display-count and + buffer-display-time whenever a buffer is displayed. + 2010-05-16 Aidan Kehoe <kehoea@parhasard.net> Move `default-file-system-ignore-case' to C; pay attention to it
--- a/src/buffer.c Mon May 24 10:43:29 2010 +0200 +++ b/src/buffer.c Fri May 28 13:48:22 2010 +0100 @@ -2307,6 +2307,8 @@ #ifdef MULE buffer_local_flags.category_table = resettable; #endif + buffer_local_flags.display_time = always_local_no_default; + buffer_local_flags.display_count = make_int (0); buffer_local_flags.modeline_format = make_int (1<<0); buffer_local_flags.abbrev_mode = make_int (1<<1); @@ -2800,6 +2802,18 @@ set when a file is visited. Automatically local in all buffers. */ ); + DEFVAR_BUFFER_LOCAL ("buffer-display-count", display_count /* +A number incremented each time this buffer is displayed in a window. +The function `set-window-buffer' updates it. +*/ ); + + DEFVAR_BUFFER_LOCAL ("buffer-display-time", display_time /* +Time stamp updated each time this buffer is displayed in a window. +The function `set-window-buffer' updates this variable +to the value obtained by calling `current-time'. +If the buffer has never been shown in a window, the value is nil. +*/); + DEFVAR_BUFFER_LOCAL_MAGIC ("buffer-invisibility-spec", invisibility_spec /* Invisibility spec of this buffer. The default is t, which means that text is invisible
--- a/src/bufslots.h Mon May 24 10:43:29 2010 +0200 +++ b/src/bufslots.h Fri May 28 13:48:22 2010 +0100 @@ -216,6 +216,12 @@ /* The string generated by formatting the modeline in this buffer. */ MARKED_SLOT (generated_modeline_string) + /* Incremented each time a buffer is displayed using set-window-buffer. */ + MARKED_SLOT (display_count) + + /* Last time this buffer was displayed using set-window-buffer. */ + MARKED_SLOT (display_time) + /* A hash table that maps from a "generic extent" (an extent in `modeline-format') into a buffer-specific extent. */ MARKED_SLOT (modeline_extent_table)
--- a/src/lisp.h Mon May 24 10:43:29 2010 +0200 +++ b/src/lisp.h Fri May 28 13:48:22 2010 +0100 @@ -4554,6 +4554,7 @@ EXFUN (Fbuffer_substring, 3); EXFUN (Fchar_after, 2); EXFUN (Fchar_to_string, 1); +EXFUN (Fcurrent_time, 0); EXFUN (Fdelete_region, 3); EXFUN (Feobp, 1); EXFUN (Feolp, 1);
--- a/src/window.c Mon May 24 10:43:29 2010 +0200 +++ b/src/window.c Fri May 28 13:48:22 2010 +0100 @@ -3757,6 +3757,11 @@ Fset_buffer (buffer); } + if (NILP (XBUFFER (buffer)->display_count)) + XBUFFER (buffer)->display_count = make_int (1); + else + XBUFFER (buffer)->display_count = make_int (1 + XINT (XBUFFER (buffer)->display_count)); + XBUFFER (buffer)->display_time = Fcurrent_time(); return Qnil; }