[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (interactive) and &optional
From: |
Emanuel Berg |
Subject: |
Re: (interactive) and &optional |
Date: |
Sun, 26 Mar 2023 03:04:21 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Jean Louis wrote:
> (defun search-something (&optional query)
> "Search something by using QUERY."
> (interactive)
> (let ((query (or query (read-from-minibuffer "Query: "))))
> (message query)))
This has the same problem as before, it should look something
like this:
;;; -*- lexical-binding: t -*-
;;
;; this file:
;; https://dataswamp.org/~incal/emacs-init/geh.el
(defun search-something (&optional query)
"Search something by using QUERY."
(interactive "sQuery: ")
(unless (and (stringp query)
(not (string= "" query)) )
(setq query "default search") )
(message query) )
;; (search-something "love") ; love
;; (search-something) ; default search
;; M-x search-something RET RET ; default search
;; M-x search-something RET love RET ; love
--
underground experts united
https://dataswamp.org/~incal
- Re: (interactive) and &optional, (continued)
Re: (interactive) and &optional, Emanuel Berg, 2023/03/23
Re: (interactive) and &optional, Jean Louis, 2023/03/24
Re: (interactive) and &optional, Emanuel Berg, 2023/03/26
RE: [External] : Re: (interactive) and &optional, Drew Adams, 2023/03/26
Re: [External] : Re: (interactive) and &optional, John Yates, 2023/03/26
Re: (interactive) and &optional, Dr Rainer Woitok, 2023/03/25