From 8f3a2c2659ddee1ae84b4b8bb28f6c388f87fd0f Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Mon, 5 Aug 2013 08:14:43 +0400 Subject: New macro to iterate over live buffers similar to frames. * buffer.h (FOR_EACH_LIVE_BUFFER): New macro. (Vbuffer_alist, Qpriority, Qbefore_string, Qafter_string): Declare buffer-related variables here to offload lisp.h. * buffer.c (Vbuffer_alist): Adjust comment. (Fget_file_buffer, get_truename_buffer, Fother_buffer) (other_buffer_safely): * data.c (store_symval_forwarding): * dispnew.c (Fframe_or_buffer_changed_p): * fileio.c (Fdo_auto_save): * filelock.c (unlock_all_files): * minibuf.c (read_minibuf): Use FOR_EACH_LIVE_BUFFER. --- src/buffer.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/buffer.h') diff --git a/src/buffer.h b/src/buffer.h index 641a561cafc..646f8f72232 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -1120,9 +1120,19 @@ record_unwind_current_buffer (void) } \ } while (0) +extern Lisp_Object Vbuffer_alist; extern Lisp_Object Qbefore_change_functions; extern Lisp_Object Qafter_change_functions; extern Lisp_Object Qfirst_change_hook; +extern Lisp_Object Qpriority, Qbefore_string, Qafter_string; + +/* FOR_EACH_LIVE_BUFFER (LIST_VAR, BUF_VAR) followed by a statement is + a `for' loop which iterates over the buffers from Vbuffer_alist. */ + +#define FOR_EACH_LIVE_BUFFER(list_var, buf_var) \ + for (list_var = Vbuffer_alist; \ + (CONSP (list_var) && (buf_var = XCDR (XCAR (list_var)), 1)); \ + list_var = XCDR (list_var)) /* Get text properties of B. */ -- cgit v1.2.1 From e30b79c1c52a4428189ca148c73e7ecc993c6f6a Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 6 Aug 2013 10:53:09 +0400 Subject: Use region cache to speedup bidi_find_paragraph_start. * src/buffer.h (struct buffer): New member bidi_paragraph_cache. Rename cache_long_line_scans to cache_long_scans. * src/buffer.c (bset_cache_long_line_scans): Rename to bset_cache_long_scans. (Fget_buffer_create, Fmake_indirect_buffer, Fkill_buffer) (Fbuffer_swap_text, init_buffer_once): Take bidi_paragraph_cache into account. (syms_of_buffer): Rename cache-long-line-scans to cache-long-scans. Adjust docstring. * src/search.c (newline_cache_on_off): * src/indent.c (width_run_cache_on_off): Adjust users. * src/bidi.c (bidi_paragraph_cache_on_off): New function. (bidi_find_paragraph_start): Use bidi_paragraph_cache if needed. * src/insdel.c (prepare_to_modify_buffer): Invalidate bidi_paragraph_cache if enabled. * doc/lispref/positions.texi (Motion by Screen Lines): * doc/lispref/display.texi (Truncation): Rename `cache-long-line-scans' to `cache-long-scans'. --- src/buffer.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/buffer.h') diff --git a/src/buffer.h b/src/buffer.h index 646f8f72232..221db39329a 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -632,9 +632,9 @@ struct buffer /* List of symbols naming the file format used for auto-save file. */ Lisp_Object INTERNAL_FIELD (auto_save_file_format); - /* True if the newline position cache and width run cache are - enabled. See search.c and indent.c. */ - Lisp_Object INTERNAL_FIELD (cache_long_line_scans); + /* True if the newline position cache, width run cache and BIDI paragraph + cache are enabled. See search.c, indent.c and bidi.c for details. */ + Lisp_Object INTERNAL_FIELD (cache_long_scans); /* If the width run cache is enabled, this table contains the character widths width_run_cache (see above) assumes. When we @@ -839,9 +839,12 @@ struct buffer the character's width; if it maps a character to zero, we don't know what its width is. This allows compute_motion to process such regions very quickly, using algebra instead of inspecting - each character. See also width_table, below. */ + each character. See also width_table, below. + + The latter cache is used to speedup bidi_find_paragraph_start. */ struct region_cache *newline_cache; struct region_cache *width_run_cache; + struct region_cache *bidi_paragraph_cache; /* Non-zero means don't use redisplay optimizations for displaying this buffer. */ -- cgit v1.2.1 From d5a1acfaa5671f09cbb8da211a5283394d8b907f Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Thu, 15 Aug 2013 18:52:53 +0400 Subject: * lisp.h (FOR_EACH_ALIST_VALUE): New macro to do `for' loops over alist values. * buffer.h (FOR_EACH_BUFFER): * process.c (FOR_EACH_PROCESS): Use it. (handle_child_signal, status_notify, Fget_buffer_process) (kill_buffer_processes): Use FOR_EACH_PROCESS. --- src/buffer.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/buffer.h') diff --git a/src/buffer.h b/src/buffer.h index 221db39329a..55a9e8d2a1c 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -1132,10 +1132,8 @@ extern Lisp_Object Qpriority, Qbefore_string, Qafter_string; /* FOR_EACH_LIVE_BUFFER (LIST_VAR, BUF_VAR) followed by a statement is a `for' loop which iterates over the buffers from Vbuffer_alist. */ -#define FOR_EACH_LIVE_BUFFER(list_var, buf_var) \ - for (list_var = Vbuffer_alist; \ - (CONSP (list_var) && (buf_var = XCDR (XCAR (list_var)), 1)); \ - list_var = XCDR (list_var)) +#define FOR_EACH_LIVE_BUFFER(list_var, buf_var) \ + FOR_EACH_ALIST_VALUE (Vbuffer_alist, list_var, buf_var) /* Get text properties of B. */ -- cgit v1.2.1 From 43aac990c339c0fc3304aa476ebc8ea8467f107e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 27 Aug 2013 11:47:55 -0700 Subject: Simplify EMACS_TIME-related code. This portability layer is no longer needed, since Emacs has been using struct timespec as a portability layer for some time. Merge from gnulib, incorporating: 2013-08-27 timespec: new convenience constants and function * src/atimer.h, src/buffer.h, src/dispextern.h, src/xgselect.h: Include rather than "systime.h"; that's all that's needed now. * src/dispnew.c: Include rather than "systime.h"; that's all that's needed now. * src/systime.h (EMACS_TIME): Remove. All uses changed to struct timespec. (EMACS_TIME_RESOLUTION): Remove. All uses changed to TIMESPEC_RESOLUTION. (LOG10_EMACS_TIME_RESOLUTION): Remove. All uses changed to LOG10_TIMESPEC_RESOLUTION. (EMACS_SECS, emacs_secs_addr): Remove. All uses changed to tv_sec. (EMACS_NSECS): Remove. All uses changed to tv_nsec. (make_emacs_time): Remove. All used changed to make_timespec. (invalid_timespec): Rename from invalid_emacs_time. All uses changed. (current_timespec): Rename from current_emacs_time. All uses changed. (add_emacs_time): Remove. All uses changed to timespec_add. (sub_emacs_time): Remove. All uses change dot timespec_sub. (EMACS_TIME_SIGN): Remove. All uses changed to timespec_sign. (timespec_valid_p): Rename from EMACS_TIME_VALID_P. All uses changed. (EMACS_TIME_FROM_DOUBLE): Remove. All uses changed to dtotimespec. (EMACS_TIME_TO_DOUBLE): Remove. All uses changed to timespectod. (current_timespec): Rename from current_emacs_time. All uses changed. (EMACS_TIME_EQ, EMACS_TIME_LT, EMACS_TIME_LE): Remove. All uses changed to timespec_cmp. * src/xgselect.c: Include , since our .h files don't. --- src/buffer.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/buffer.h') diff --git a/src/buffer.h b/src/buffer.h index 55a9e8d2a1c..bedb7890939 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -18,8 +18,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -#include /* for off_t, time_t */ -#include "systime.h" /* for EMACS_TIME */ +#include +#include INLINE_HEADER_BEGIN #ifndef BUFFER_INLINE @@ -794,13 +794,13 @@ struct buffer char local_flags[MAX_PER_BUFFER_VARS]; /* Set to the modtime of the visited file when read or written. - EMACS_NSECS (modtime) == NONEXISTENT_MODTIME_NSECS means - visited file was nonexistent. EMACS_NSECS (modtime) == + modtime.tv_nsec == NONEXISTENT_MODTIME_NSECS means + visited file was nonexistent. modtime.tv_nsec == UNKNOWN_MODTIME_NSECS means visited file modtime unknown; in no case complain about any mismatch on next save attempt. */ #define NONEXISTENT_MODTIME_NSECS (-1) #define UNKNOWN_MODTIME_NSECS (-2) - EMACS_TIME modtime; + struct timespec modtime; /* Size of the file when modtime was set. This is used to detect the case where the file grew while we were reading it, so the modtime -- cgit v1.2.1 From 032f74518a71a7fe0afd2e7d0eee11bfb7ae90d9 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Thu, 29 Aug 2013 20:36:54 +0400 Subject: * intervals.c (set_point_from_marker): New function. * editfns.c (Fgoto_char): * process.c (Finternal_default_process_filter): * window.c (select_window_1): Use it. * buffer.h (set_point_from_marker): Add prototype. --- src/buffer.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/buffer.h') diff --git a/src/buffer.h b/src/buffer.h index bedb7890939..169a15c7d0f 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -249,6 +249,7 @@ extern void temp_set_point (struct buffer *, ptrdiff_t); extern void set_point_both (ptrdiff_t, ptrdiff_t); extern void temp_set_point_both (struct buffer *, ptrdiff_t, ptrdiff_t); +extern void set_point_from_marker (Lisp_Object); extern void enlarge_buffer_text (struct buffer *, ptrdiff_t); -- cgit v1.2.1