 
 
 ;; KEYBOARD MAPPINGS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defun minibuffer-arg (function prompt &optional initial)
-    (lexical-let ((f function) (p prompt) (i initial))
-        (lambda ()
-            (interactive)
-            ;; note: use of the INITIAL argument is discouraged, but here it makes sense
-            (let ((arg (read-from-minibuffer p i)))
-                (if arg (funcall f arg))))))
-
-(defun char-arg (function prompt)
-    (lexical-let ((f function) (p prompt))
-        (lambda ()
-            (interactive)
-            (let ((c (read-char p)))
-                (if c (funcall f c))))))
-
 ;; Note: when updating this list of mappings, also update the PKB
+
+(defun prompt-for-string (function prompt &optional initial)
+    ;; note: use of the INITIAL argument is discouraged, but here it makes sense
+    (let ((arg (read-from-minibuffer prompt initial)))
+        (if arg (funcall function arg))))
+
+(defun prompt-for-char (function prompt)
+    (let ((c (read-char prompt)))
+        (if c (funcall function c))))
+
+(defun smsn-insert-attr-priority-prompt ()
+    (interactive)
+    (prompt-for-char 'smsn-insert-attr-priority "priority = ?"))
+
+(defun smsn-insert-attr-sharability-prompt ()
+    (interactive)
+    (prompt-for-char 'smsn-insert-attr-sharability "sharability = ?"))
+
+(defun smsn-insert-attr-weight-prompt ()
+    (interactive)
+    (prompt-for-char 'smsn-insert-attr-weight "weight = ?"))
+
+(defun smsn-set-view-height-prompt ()
+    (interactive)
+    (prompt-for-char 'smsn-set-view-height "height = ?"))
+
+(defun smsn-export-edges-prompt ()
+    (interactive)
+    (prompt-for-string 'smsn-export-edges "export edges to file: " smsn-default-edges-file))
+
+(defun smsn-export-graphml-prompt ()
+    (interactive)
+    (prompt-for-string 'smsn-export-graphml "export GraphML to file: " smsn-default-graphml-file))
+
+(defun smsn-export-latex-prompt ()
+    (interactive)
+    (prompt-for-string 'smsn-export-latex "export LaTeX to file: " smsn-default-latex-file))
+
+(defun smsn-export-pagerank-prompt ()
+    (interactive)
+    (prompt-for-string 'smsn-export-pagerank "export PageRank results to file: " smsn-default-pagerank-file))
+
+(defun smsn-export-rdf-prompt ()
+    (interactive)
+    (prompt-for-string 'smsn-export-rdf "export private RDF dump to file: " smsn-default-rdf-file))
+
+(defun smsn-export-vertices-prompt ()
+    (interactive)
+    (prompt-for-string 'smsn-export-vertices "export vertices to file: " smsn-default-vertices-file))
+
+(defun smsn-export-webrdf-prompt ()
+    (interactive)
+    (prompt-for-string 'smsn-export-webrdf "export public Web RDF dump to file: " smsn-default-webrdf-file))
+
+(defun smsn-import-graphml-prompt ()
+    (interactive)
+    (prompt-for-string 'smsn-import-graphml "import GraphML from file: " smsn-default-graphml-file))
+
+(defun smsn-goto-line-prompt ()
+    (interactive)
+    (prompt-for-string 'smsn-goto-line "line: "))
+
+(defun smsn-set-default-sharability-prompt ()
+    (interactive)
+    (prompt-for-char 'smsn-set-default-sharability "default sharability = ?"))
+
+(defun smsn-set-min-sharability-prompt ()
+    (interactive)
+    (prompt-for-char 'smsn-set-min-sharability "minimum sharability = ?"))
+
+(defun smsn-set-target-priority-prompt ()
+    (interactive)
+    (prompt-for-char 'smsn-set-target-priority "new priority = ?"))
+
+(defun smsn-set-target-sharability-prompt ()
+    (interactive)
+    (prompt-for-char 'smsn-set-target-sharability "new sharability = ?"))
+
+(defun smsn-set-target-weight-prompt ()
+    (interactive)
+    (prompt-for-char 'smsn-set-target-weight "new weight = ?"))
+
+(defun smsn-set-value-truncation-length-prompt ()
+    (interactive)
+    (prompt-for-string 'smsn-set-value-truncation-length "value truncation length: "))
+
+(defun smsn-set-default-weight-prompt ()
+    (interactive)
+    (prompt-for-char 'smsn-set-default-weight "default weight = ?"))
+
+(defun smsn-set-min-weight-prompt ()
+    (interactive)
+    (prompt-for-char 'smsn-set-min-weight "minimun weight = ?"))
+
+(defun smsn-acronym-query-prompt ()
+    (interactive)
+    (prompt-for-string 'smsn-acronym-query "acronym search for: "))
+
+(defun smsn-shortcut-query-prompt ()
+    (interactive)
+    (prompt-for-string 'smsn-shortcut-query "shortcut search for: "))
+
+(defun smsn-ripple-query-prompt ()
+    (interactive)
+    (prompt-for-string 'smsn-ripple-query "ripple query: "))
+
+(defun smsn-fulltext-query-prompt ()
+    (interactive)
+    (let (
+      (newcol (atom-color-at-visibility-threshold))
+      (oldcol (face-foreground 'minibuffer-prompt)))
+        (set-face-foreground 'minibuffer-prompt newcol)
+        (prompt-for-string 'smsn-fulltext-query "full-text search for: ")
+        (set-face-foreground 'minibuffer-prompt oldcol)))
+
 (global-set-key (kbd "C-c C-I f")       'smsn-find-isolated-atoms)
 (global-set-key (kbd "C-c C-I r")       'smsn-remove-isolated-atoms)
-(global-set-key (kbd "C-c C-a C-p")     (char-arg 'smsn-insert-attr-priority "priority = ?"))
-(global-set-key (kbd "C-c C-a C-s")     (char-arg 'smsn-insert-attr-sharability "sharability = ?"))
-(global-set-key (kbd "C-c C-a C-w")     (char-arg 'smsn-insert-attr-weight "weight = ?"))
+(global-set-key (kbd "C-c C-a C-p")     'smsn-insert-attr-priority-prompt)
+(global-set-key (kbd "C-c C-a C-s")     'smsn-insert-attr-sharability-prompt)
+(global-set-key (kbd "C-c C-a C-w")     'smsn-insert-attr-weight-prompt)
 (global-set-key (kbd "C-c C-a d")       'smsn-insert-current-date)
 (global-set-key (kbd "C-c C-a s")       'smsn-insert-current-time-with-seconds)
 (global-set-key (kbd "C-c C-a t")       'smsn-insert-current-time)
-(global-set-key (kbd "C-c C-d")         (char-arg 'smsn-set-view-height "height = ?"))
-(global-set-key (kbd "C-c C-e e")       (minibuffer-arg 'smsn-export-edges "export edges to file: " smsn-default-edges-file))
-(global-set-key (kbd "C-c C-e g")       (minibuffer-arg 'smsn-export-graphml "export GraphML to file: " smsn-default-graphml-file))
-(global-set-key (kbd "C-c C-e l")       (minibuffer-arg 'smsn-export-latex "export LaTeX to file: " smsn-default-latex-file))
-(global-set-key (kbd "C-c C-e p")       (minibuffer-arg 'smsn-export-pagerank "export PageRank results to file: " smsn-default-pagerank-file))
-(global-set-key (kbd "C-c C-e r")       (minibuffer-arg 'smsn-export-rdf "export private RDF dump to file: " smsn-default-rdf-file))
-(global-set-key (kbd "C-c C-e v")       (minibuffer-arg 'smsn-export-vertices "export vertices to file: " smsn-default-vertices-file))
-(global-set-key (kbd "C-c C-e w")       (minibuffer-arg 'smsn-export-webrdf "export public Web RDF dump to file: " smsn-default-webrdf-file))
-(global-set-key (kbd "C-c C-i g")       (minibuffer-arg 'smsn-import-graphml "import GraphML from file: " smsn-default-graphml-file))
-(global-set-key (kbd "C-c C-l")         (minibuffer-arg 'smsn-goto-line "line: "))
+(global-set-key (kbd "C-c C-d")         'smsn-set-view-height-prompt)
+(global-set-key (kbd "C-c C-e e")       'smsn-export-edges-prompt)
+(global-set-key (kbd "C-c C-e g")       'smsn-export-graphml-prompt)
+(global-set-key (kbd "C-c C-e l")       'smsn-export-latex-prompt)
+(global-set-key (kbd "C-c C-e p")       'smsn-export-pagerank-prompt)
+(global-set-key (kbd "C-c C-e r")       'smsn-export-rdf-prompt)
+(global-set-key (kbd "C-c C-e v")       'smsn-export-vertices-prompt)
+(global-set-key (kbd "C-c C-e w")       'smsn-export-webrdf-prompt)
+(global-set-key (kbd "C-c C-i g")       'smsn-import-graphml-prompt)
+(global-set-key (kbd "C-c C-l")         'smsn-goto-line-prompt)
 (global-set-key (kbd "C-c C-r C-b a")   (smsn-visit-in-amazon 'current-root-value))
 (global-set-key (kbd "C-c C-r C-b e")   (smsn-visit-in-ebay 'current-root-value))
 (global-set-key (kbd "C-c C-r C-b d")   (smsn-visit-in-delicious 'current-root-value))

          (high color))
        (weighted-average low high weight)))

(defun find-color (weight sharability bright has-meta)
    (let ((s
        (if (using-inference)
            (elt (if bright inference-bright-colors inference-base-colors) (if has-meta 0 1))

(global-set-key (kbd "C-c C-v p")       'smsn-toggle-properties-view)
(global-set-key (kbd "C-c C-v r")       'smsn-enter-readonly-view)
(global-set-key (kbd "C-c C-v s")       'smsn-toggle-emacspeak)
(global-set-key (kbd "C-c C-v t")       'smsn-set-value-truncation-length-prompt)
(global-set-key (kbd "C-c C-v v")       'smsn-toggle-minimize-verbatim-blocks)
(global-set-key (kbd "C-c C-w C-d")     'smsn-set-default-weight-prompt)
(global-set-key (kbd "C-c C-w C-m")     'smsn-set-min-weight-prompt)
(global-set-key (kbd "C-c a")           'smsn-acronym-query-prompt)
(global-set-key (kbd "C-c b")           'smsn-visit-url-at-point)
(global-set-key (kbd "C-c d")           'smsn-duplicates)
(global-set-key (kbd "C-c f")           'smsn-find-roots)
(global-set-key (kbd "C-c h")           'smsn-history)
(global-set-key (kbd "C-c i")           'smsn-infer-types)
(global-set-key (kbd "C-c o")           'smsn-shortcut-query-prompt)
(global-set-key (kbd "C-c P")           'smsn-priorities)
(global-set-key (kbd "C-c p")           'smsn-push-view)
(global-set-key (kbd "C-c r")           'smsn-ripple-query-prompt)
(global-set-key (kbd "C-c s")           'smsn-fulltext-query-prompt)
(global-set-key (kbd "C-c t")           'smsn-visit-target)
(global-set-key (kbd "C-c u")           'smsn-update-view)
(global-set-key (kbd "C-c v")           'smsn-events)
