Skip to content

Commit

Permalink
Merge pull request #56 from jcsims/print-path-to-minibuffer
Browse files Browse the repository at this point in the history
Print path to JSON node to minibuffer, instead of temp buffer
  • Loading branch information
joshwnj authored Jul 18, 2018
2 parents 32d5a9b + 3006f8e commit ffc92b1
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions json-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,9 @@ This function calls `json-mode--update-auto-mode' to change the

;;;###autoload
(defun json-mode-show-path ()
"Print the path to the node at point to the minibuffer, and yank to the kill ring."
(interactive)
(let ((temp-name "*json-path*"))
(with-output-to-temp-buffer temp-name (jsons-print-path))

(let ((temp-window (get-buffer-window temp-name)))
;; delete the window if we have one,
;; so we can recreate it in the correct position
(if temp-window
(delete-window temp-window))

;; always put the temp window below the json window
(set-window-buffer (if (fboundp 'split-window-below)
(split-window-below)
(split-window-vertically)) temp-name))
))
(message (jsons-print-path)))

(define-key json-mode-map (kbd "C-c C-p") 'json-mode-show-path)

Expand Down

0 comments on commit ffc92b1

Please sign in to comment.