mirror of
https://github.com/m00natic/vlfi.git
synced 2025-02-12 07:58:09 +00:00
Add command to unconditionally open fresh VLF buffer to visit occur
match.
This commit is contained in:
parent
a65f3a431d
commit
42e581da61
38
vlf.el
38
vlf.el
@ -645,6 +645,7 @@ Search is performed chunk by chunk in `vlf-batch-size' memory."
|
|||||||
(define-key map "n" 'vlf-occur-next-match)
|
(define-key map "n" 'vlf-occur-next-match)
|
||||||
(define-key map "p" 'vlf-occur-prev-match)
|
(define-key map "p" 'vlf-occur-prev-match)
|
||||||
(define-key map "\C-m" 'vlf-occur-visit)
|
(define-key map "\C-m" 'vlf-occur-visit)
|
||||||
|
(define-key map "\M-\r" 'vlf-occur-visit-new-buffer)
|
||||||
(define-key map [mouse-1] 'vlf-occur-visit)
|
(define-key map [mouse-1] 'vlf-occur-visit)
|
||||||
(define-key map "o" 'vlf-occur-show)
|
(define-key map "o" 'vlf-occur-show)
|
||||||
map)
|
map)
|
||||||
@ -684,10 +685,16 @@ EVENT may hold details of the invocation."
|
|||||||
(vlf-occur-visit event)
|
(vlf-occur-visit event)
|
||||||
(pop-to-buffer occur-buffer)))
|
(pop-to-buffer occur-buffer)))
|
||||||
|
|
||||||
|
(defun vlf-occur-visit-new-buffer ()
|
||||||
|
"Visit `vlf-occur' link in new vlf buffer."
|
||||||
|
(interactive)
|
||||||
|
(let ((current-prefix-arg t))
|
||||||
|
(vlf-occur-visit)))
|
||||||
|
|
||||||
(defun vlf-occur-visit (&optional event)
|
(defun vlf-occur-visit (&optional event)
|
||||||
"Visit current `vlf-occur' link in a vlf buffer.
|
"Visit current `vlf-occur' link in a vlf buffer.
|
||||||
If original VLF buffer has been killed,
|
With prefix argument or if original VLF buffer has been killed,
|
||||||
open new VLF session each time.
|
open new VLF session.
|
||||||
EVENT may hold details of the invocation."
|
EVENT may hold details of the invocation."
|
||||||
(interactive (list last-nonmenu-event))
|
(interactive (list last-nonmenu-event))
|
||||||
(when event
|
(when event
|
||||||
@ -699,20 +706,23 @@ EVENT may hold details of the invocation."
|
|||||||
(if file
|
(if file
|
||||||
(let ((chunk-start (get-char-property pos 'chunk-start))
|
(let ((chunk-start (get-char-property pos 'chunk-start))
|
||||||
(chunk-end (get-char-property pos 'chunk-end))
|
(chunk-end (get-char-property pos 'chunk-end))
|
||||||
(buffer (get-char-property pos 'buffer))
|
(vlf-buffer (get-char-property pos 'buffer))
|
||||||
|
(occur-buffer (current-buffer))
|
||||||
(match-pos (+ (get-char-property pos 'line-pos)
|
(match-pos (+ (get-char-property pos 'line-pos)
|
||||||
pos-relative)))
|
pos-relative)))
|
||||||
(or (buffer-live-p buffer)
|
(cond (current-prefix-arg
|
||||||
(let ((occur-buffer (current-buffer)))
|
(setq vlf-buffer (vlf file))
|
||||||
(or (catch 'found
|
(switch-to-buffer occur-buffer))
|
||||||
(dolist (buf (buffer-list))
|
((not (buffer-live-p vlf-buffer))
|
||||||
(set-buffer buf)
|
(or (catch 'found
|
||||||
(and vlf-mode (equal file buffer-file-name)
|
(dolist (buf (buffer-list))
|
||||||
(setq buffer buf)
|
(set-buffer buf)
|
||||||
(throw 'found t))))
|
(and vlf-mode (equal file buffer-file-name)
|
||||||
(setq buffer (vlf file)))
|
(setq vlf-buffer buf)
|
||||||
(switch-to-buffer occur-buffer)))
|
(throw 'found t))))
|
||||||
(pop-to-buffer buffer)
|
(setq vlf-buffer (vlf file)))
|
||||||
|
(switch-to-buffer occur-buffer)))
|
||||||
|
(pop-to-buffer vlf-buffer)
|
||||||
(vlf-move-to-chunk chunk-start chunk-end)
|
(vlf-move-to-chunk chunk-start chunk-end)
|
||||||
(goto-char match-pos)))))
|
(goto-char match-pos)))))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user