[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf b14c912 290/310: Copy around buffer specific profil
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf b14c912 290/310: Copy around buffer specific profile vectors when forking new buffers. |
Date: |
Sat, 28 Nov 2020 00:33:34 -0500 (EST) |
branch: externals/vlf
commit b14c912afbbb8f132d3a4c559207c3bab3b9ea87
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Copy around buffer specific profile vectors when forking new buffers.
---
vlf-occur.el | 28 +++++++++++-----------------
vlf-tune.el | 18 ++++++++++++++++++
2 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/vlf-occur.el b/vlf-occur.el
index 4d4d261..8b6d7c4 100644
--- a/vlf-occur.el
+++ b/vlf-occur.el
@@ -127,7 +127,10 @@ EVENT may hold details of the invocation."
(match-pos (+ (get-text-property pos 'line-pos)
pos-relative)))
(cond (current-prefix-arg
- (setq vlf-buffer (vlf file t))
+ (let ((original-occur-buffer vlf-occur-vlf-buffer))
+ (setq vlf-buffer (vlf file t))
+ (if (buffer-live-p original-occur-buffer)
+ (vlf-tune-copy-profile original-occur-buffer)))
(or not-hexl (hexl-mode))
(switch-to-buffer occur-buffer))
((not (buffer-live-p vlf-buffer))
@@ -155,9 +158,7 @@ Prematurely ending indexing will still show what's found so
far."
(file buffer-file-name)
(file-size vlf-file-size)
(batch-size vlf-batch-size)
- (is-hexl (derived-mode-p 'hexl-mode))
- (insert-bps vlf-tune-insert-bps)
- (insert-raw-bps vlf-tune-insert-raw-bps))
+ (is-hexl (derived-mode-p 'hexl-mode)))
(with-temp-buffer
(setq buffer-file-name file
buffer-file-truename file
@@ -166,23 +167,16 @@ Prematurely ending indexing will still show what's found
so far."
(set-buffer-modified-p nil)
(set (make-local-variable 'vlf-batch-size) batch-size)
(when vlf-tune-enabled
- (setq vlf-tune-insert-bps insert-bps)
- (if is-hexl
- (progn (setq vlf-tune-insert-raw-bps insert-raw-bps)
- (vlf-tune-batch '(:hexl :raw) t))
- (vlf-tune-batch '(:insert :encode) t)))
+ (vlf-tune-copy-profile vlf-buffer)
+ (vlf-tune-batch (if is-hexl
+ '(:hexl :raw)
+ '(:insert :encode)) t))
(vlf-mode 1)
(if is-hexl (hexl-mode))
(goto-char (point-min))
(vlf-build-occur regexp vlf-buffer)
- (when vlf-tune-enabled
- (setq insert-bps vlf-tune-insert-bps)
- (if is-hexl
- (setq insert-raw-bps vlf-tune-insert-raw-bps))))
- (when vlf-tune-enabled ;merge back tune measurements
- (setq vlf-tune-insert-bps insert-bps)
- (if is-hexl
- (setq vlf-tune-insert-raw-bps insert-raw-bps)))))
+ (if vlf-tune-enabled
+ (vlf-tune-copy-profile (current-buffer) vlf-buffer)))))
(defun vlf-occur (regexp)
"Make whole file occur style index for REGEXP.
diff --git a/vlf-tune.el b/vlf-tune.el
index 74aadec..21441f5 100644
--- a/vlf-tune.el
+++ b/vlf-tune.el
@@ -98,11 +98,29 @@ Avoid decreasing this after opening file with VLF."
(defvar vlf-tune-dehexlify-bps nil
"Vector of bytes per second dehexlify measurements.")
+(defvar vlf-start-pos)
(defvar hexl-bits)
(defvar hexl-max-address)
(declare-function hexl-line-displen "hexl")
(declare-function dehexlify-buffer "hexl")
+(defun vlf-tune-copy-profile (from-buffer &optional to-buffer)
+ "Copy specific profile vectors of FROM-BUFFER to TO-BUFFER.
+If TO-BUFFER is nil, copy to current buffer."
+ (let (insert-bps insert-raw-bps encode-bps)
+ (with-current-buffer from-buffer
+ (setq insert-bps vlf-tune-insert-bps
+ insert-raw-bps vlf-tune-insert-raw-bps
+ encode-bps vlf-tune-encode-bps))
+ (if to-buffer
+ (with-current-buffer to-buffer
+ (setq vlf-tune-insert-bps insert-bps
+ vlf-tune-insert-raw-bps insert-raw-bps
+ vlf-tune-encode-bps encode-bps))
+ (setq vlf-tune-insert-bps insert-bps
+ vlf-tune-insert-raw-bps insert-raw-bps
+ vlf-tune-encode-bps encode-bps))))
+
(defun vlf-tune-closest-index (size)
"Get closest measurement index corresponding to SIZE."
(let ((step (float vlf-tune-step)))
- [elpa] externals/vlf 3cfa9b1 273/310: Refactor vlf-query-replace and don't adjust batch size if only, (continued)
- [elpa] externals/vlf 3cfa9b1 273/310: Refactor vlf-query-replace and don't adjust batch size if only, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 61599a0 274/310: Change linear tune to search only known measures and use it to, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a9c14e2 268/310: Add regexp query replace over whole file command., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 673ae08 277/310: Lower tramp verbosity level., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf ac8d400 276/310: Fixes to hexl-mode activation., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f63ea96 272/310: Document new query replace and save options., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e4a2e80 266/310: Optimize goto-line for hexl-mode, no need to search., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 7b9befe 275/310: - don't load unnecessary data at the end of search or occur, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 842569a 270/310: Add ability to use temporary file when adjusting content on save., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf d579b7b 279/310: Workaround local maximum in batch tune., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf b14c912 290/310: Copy around buffer specific profile vectors when forking new buffers.,
Stefan Monnier <=
- [elpa] externals/vlf b300137 292/310: Encode smaller region to detect cut point overall offset in vlf-occur, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 86be483 293/310: Improve search precision., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a8ba836 298/310: Fix issue where tramp-verbose is bound to nil., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 25e16ef 303/310: Fix broken link in README, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf b62bc04 301/310: Issue 31 Make vlf-batch-size configurable in the remote case, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 55e0c40 300/310: Explicitly set coding-system-for-read to the current coding when not, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 4eaf763 297/310: Rename vlf-integrate.el to vlf-setup.el, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf efffeb5 310/310: Bump vlf version after previous fix, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f4aa108 308/310: * vlf.el: Use GPL version 3, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf f4ee23c 156/310: Fix chunk end adjustment and save for current and older Emacsen., Stefan Monnier, 2020/11/28