mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-19 13:46:17 +10:00
Testing completion-read.
This commit is contained in:
@@ -703,22 +703,12 @@
|
|||||||
|
|
||||||
(defun reader ()
|
(defun reader ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((choices '(("First" . "First")
|
(let ((choices '(("First" . "Hi!")
|
||||||
("Second" . 'second-choice)
|
("Second" . 'second-choice)
|
||||||
("Third" . 'third-choice))))
|
("Third" . 'third-choice))))
|
||||||
(alist-get
|
(alist-get
|
||||||
(completing-read "Choose: " choices)
|
(completing-read "Choose: " choices)
|
||||||
choices nil t 'equal)))
|
choices nil nil 'message)))
|
||||||
|
|
||||||
(setq yy-keywords
|
|
||||||
'("touch"
|
|
||||||
"touch_start"
|
|
||||||
"touch_end"
|
|
||||||
"for"
|
|
||||||
"foreach"
|
|
||||||
"forall"
|
|
||||||
))
|
|
||||||
|
|
||||||
|
|
||||||
(defun github-code-search ()
|
(defun github-code-search ()
|
||||||
"Search code on github for a given language."
|
"Search code on github for a given language."
|
||||||
@@ -730,7 +720,24 @@
|
|||||||
(browse-url
|
(browse-url
|
||||||
(concat "https://github.com/search?l=" language
|
(concat "https://github.com/search?l=" language
|
||||||
"&type=code&q=" code))))
|
"&type=code&q=" code))))
|
||||||
<<<<<<< HEAD
|
|
||||||
|
(defun dm-search ()
|
||||||
|
"Search various search engines."
|
||||||
|
(interactive)
|
||||||
|
(let ((engine (completing-read
|
||||||
|
"Search Engine: "
|
||||||
|
'("Arch Wiki"
|
||||||
|
"Bing"
|
||||||
|
"Google"
|
||||||
|
"Wikipedia")))
|
||||||
|
(query (read-string "Query: ")))
|
||||||
|
(if (equal engine "Google")
|
||||||
|
(browse-url
|
||||||
|
(concat "https://www.google.com/search?q=" query)))))
|
||||||
|
|
||||||
=======
|
(defun dt/key-value-completing (choice)
|
||||||
>>>>>>> 987492dc041b7a12f6a57be035df64dd74fc6c09
|
(interactive
|
||||||
|
(list
|
||||||
|
(let ((completions '(("1" "One") ("2" "Two") ("3" "Three"))))
|
||||||
|
(cadr (assoc (completing-read "Choose: " completions) completions)))))
|
||||||
|
(message "You choose `%s'" choice))
|
||||||
|
|||||||
@@ -1032,22 +1032,12 @@ With Emacs version 29, true transparency has been added. I have turned transpar
|
|||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defun reader ()
|
(defun reader ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((choices '(("First" . "First")
|
(let ((choices '(("First" . "Hi!")
|
||||||
("Second" . 'second-choice)
|
("Second" . 'second-choice)
|
||||||
("Third" . 'third-choice))))
|
("Third" . 'third-choice))))
|
||||||
(alist-get
|
(alist-get
|
||||||
(completing-read "Choose: " choices)
|
(completing-read "Choose: " choices)
|
||||||
choices nil t 'equal)))
|
choices nil nil 'message)))
|
||||||
|
|
||||||
(setq yy-keywords
|
|
||||||
'("touch"
|
|
||||||
"touch_start"
|
|
||||||
"touch_end"
|
|
||||||
"for"
|
|
||||||
"foreach"
|
|
||||||
"forall"
|
|
||||||
))
|
|
||||||
|
|
||||||
|
|
||||||
(defun github-code-search ()
|
(defun github-code-search ()
|
||||||
"Search code on github for a given language."
|
"Search code on github for a given language."
|
||||||
@@ -1060,4 +1050,25 @@ With Emacs version 29, true transparency has been added. I have turned transpar
|
|||||||
(concat "https://github.com/search?l=" language
|
(concat "https://github.com/search?l=" language
|
||||||
"&type=code&q=" code))))
|
"&type=code&q=" code))))
|
||||||
|
|
||||||
|
(defun dm-search ()
|
||||||
|
"Search various search engines."
|
||||||
|
(interactive)
|
||||||
|
(let ((engine (completing-read
|
||||||
|
"Search Engine: "
|
||||||
|
'("Arch Wiki"
|
||||||
|
"Bing"
|
||||||
|
"Google"
|
||||||
|
"Wikipedia")))
|
||||||
|
(query (read-string "Query: ")))
|
||||||
|
(if (equal engine "Google")
|
||||||
|
(browse-url
|
||||||
|
(concat "https://www.google.com/search?q=" query)))))
|
||||||
|
|
||||||
|
(defun dt/key-value-completing (choice)
|
||||||
|
(interactive
|
||||||
|
(list
|
||||||
|
(let ((completions '(("1" "One") ("2" "Two") ("3" "Three"))))
|
||||||
|
(cadr (assoc (completing-read "Choose: " completions) completions)))))
|
||||||
|
(message "You choose `%s'" choice))
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|||||||
Reference in New Issue
Block a user