簡體   English   中英

read-minibuffer函數輸入字符串,帶“標點符號”

[英]read-minibuffer function input string with " Punctuation

我寫了emacs lisp代碼如下:

#!/usr/bin/emacs --script
(setq input (read-minibuffer "please input your name:") )
(message "%s" input)

然后我使用此代碼來測試標准輸入:

./test.el
please input your name:hello
hello

這對第一次測試沒問題。 但是當我把字符串hello,world到標准輸入時,它會發生錯誤:

please input your name:hello,world
Trailing garbage following expression

然后我將字符串"hello,world"到標准輸入中,它通過:

please input your name:"hello,world"
hello,world

然后我想知道,我該怎么做才能得到沒有"標點符號"的輸入字符串。我只想輸入hello,world ,而不是"hello,world" 。謝謝

函數read-minibuffer期望用戶輸入Lisp對象。 如果輸入hello ,則返回一個符號,如果輸入"hello,world" ,則返回一個字符串。

你可能想要函數read-from-minibuffer 它返回用戶輸入的字符串,而不試圖以任何方式解釋它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM