1
0
mirror of https://github.com/m00natic/vlfi.git synced 2025-01-18 20:10:47 +00:00

Add check if VLFI buffer has been modified before occur jumping to new

chunk.
This commit is contained in:
Andrey Kotlarski 2013-04-17 12:49:29 +03:00
parent b8cc34422e
commit e4d886a3e3

12
vlfi.el
View File

@ -585,13 +585,21 @@ EVENT may hold details of the invocation."
(match-pos (or (get-char-property pos 'match-pos)
(+ (get-char-property pos 'line-pos)
pos-relative))))
(unless (buffer-live-p buffer)
(or (buffer-live-p buffer)
(let ((occur-buffer (current-buffer)))
(setq buffer (vlfi file))
(switch-to-buffer occur-buffer)))
(pop-to-buffer buffer)
(if (buffer-modified-p)
(cond ((and (= vlfi-start-pos chunk-start)
(= vlfi-end-pos chunk-end))
(goto-char match-pos))
((y-or-n-p "VLFI buffer has been modified. \
Really jump to new chunk? ")
(vlfi-move-to-chunk chunk-start chunk-end)
(goto-char match-pos)))))
(goto-char match-pos)))
(vlfi-move-to-chunk chunk-start chunk-end)
(goto-char match-pos))))))
(defun vlfi-occur (regexp)
"Make whole file occur style index for REGEXP.