From f6c97546b31acbb517097a5fa3fc20fb28a3b953 Mon Sep 17 00:00:00 2001
From: Ralf Jung <jung@mpi-sws.org>
Date: Mon, 29 Jan 2018 13:08:44 +0100
Subject: [PATCH] update emacs snippet

---
 Editor.md | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/Editor.md b/Editor.md
index 6048fd51c..fd8b58fe9 100644
--- a/Editor.md
+++ b/Editor.md
@@ -22,8 +22,15 @@ Next, add the following to your `~/.emacs` to configure an input method based on
 (require 'math-symbol-lists)
 ; Automatically use math input method for Coq files
 (add-hook 'coq-mode-hook (lambda () (set-input-method "math")))
-; Use math input method for the minibuffer
-(add-hook 'minibuffer-setup-hook (lambda () (set-input-method "math")))
+; Input method for the minibuffer
+(defun my-inherit-input-method ()
+  "Inherit input method from `minibuffer-selected-window'."
+  (let* ((win (minibuffer-selected-window))
+         (buf (and win (window-buffer win))))
+    (when buf
+      (activate-input-method (buffer-local-value 'current-input-method buf)))))
+(add-hook 'minibuffer-setup-hook #'my-inherit-input-method)
+; Define the actual input method
 (quail-define-package "math" "UTF-8" "Ω" t)
 (quail-define-rules ; add whatever extra rules you want to define here...
  ("\\mult"   ?â‹…)
-- 
GitLab