From 00e21fcd204d6817fa4f1076673bc45b96a640ec Mon Sep 17 00:00:00 2001 From: Pavel Kurnosov Date: Thu, 14 Apr 2016 14:29:27 +0100 Subject: Added local keymap Local keymap allows to quit current buffer or query for new place. --- wttrin.el | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'wttrin.el') diff --git a/wttrin.el b/wttrin.el index b44554d..a8d9b85 100644 --- a/wttrin.el +++ b/wttrin.el @@ -36,6 +36,10 @@ (lambda (status) (switch-to-buffer (current-buffer)))) (decode-coding-string (buffer-string) 'utf-8)))) +(defun wttrin-exit () + (interactive) + (quit-window t)) + (defun wttrin-query (city-name) "Query weather of CITY-NAME via wttrin, and display the result in new buffer." (let ((raw-string (wttrin-fetch-raw-string city-name))) @@ -49,6 +53,9 @@ (goto-char (point-min)) (re-search-forward "^$") (delete-region (point-min) (1+ (point))) + (use-local-map (make-sparse-keymap)) + (local-set-key "q" 'wttrin-exit) + (local-set-key "g" 'wttrin) (setq buffer-read-only t))))) ;;;###autoload -- cgit v1.2.3