[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 144/352: Muutetaan ulkoisen ohjelman argumentit listaksi
From: |
Stefan Monnier |
Subject: |
[elpa] 144/352: Muutetaan ulkoisen ohjelman argumentit listaksi |
Date: |
Mon, 07 Jul 2014 14:03:21 +0000 |
monnier pushed a commit to branch master
in repository elpa.
commit 323998beec02fc7ecc0ed0a444b158415d098d9c
Author: Teemu Likonen <address@hidden>
Date: Sat Feb 13 20:08:48 2010 +0000
Muutetaan ulkoisen ohjelman argumentit listaksi
Aiemmin ulkoiselle ohjelmalle on määritelty argumentit merkkijonona
muodossa (args . "-l -d fi_FI"). Tämä merkkijono on sitten
automaattisesti hajotettu listaksi ("-l" "-d" "fi_FI"), jotta ulkoiselle
ohjelmalle menevät argumentit saadaan erotettua.
Nyt käyttäjä määrittelee argumentit jo alun alkaen listana, jossa
jokainen elementti on yksi argumentti. Tämä on varmatoimisempi, koska ei
olla enää riippuvaisia funktiosta, joka hajottaa argumenttimerkkijonon
listaksi. Teoriassa hajotusfunktio ei aina tuottaisi sellaista tulosta,
jota käyttäjä odottaa.
Edelleenkin vanha määrittelytapa (yksi merkkijono) toimii, joten
yhteensopivuutta ei ole rikottu. Merkkijonona määritellyt argumentit
muutetaan kuitenkin sisäisesti listaksi, ja myös customize ohjaa
käyttäjää tekemään sen listaksi.
---
wcheck-mode.el | 43 ++++++++++++++++++++++++++++++-------------
1 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/wcheck-mode.el b/wcheck-mode.el
index 4e278a2..762cef9 100644
--- a/wcheck-mode.el
+++ b/wcheck-mode.el
@@ -63,7 +63,9 @@ program
for spell-checking LANGUAGE. This setting is mandatory.
args
- Optional command-line argument string for the program.
+ Optional command-line arguments for the program. The VALUE
+ is a list of strings. Each string is a single argument for
+ the program.
connection
The VALUE is used to set variable `process-connection-type'
@@ -143,17 +145,17 @@ An example contents of the `wcheck-language-data'
variable:
((\"suomi\"
(program . \"/usr/bin/enchant\")
- (args . \"-l -d fi_FI\"))
- (syntax . my-finnish-syntax-table)
+ (args \"-l\" \"-d\" \"fi_FI\")
+ (syntax . my-finnish-syntax-table))
(\"British English\"
(program . \"/usr/bin/ispell\")
- (args . \"-l -d british\")
+ (args \"-l\" \"-d\" \"british\"))
(\"Trailing whitespace\"
(program . \"/bin/cat\")
(regexp-start . \"\")
(regexp-body . \"\\\\s-+\")
(regexp-end . \"$\")
- (regexp-discard . \"\"))))"
+ (regexp-discard . \"\")))"
:group 'wcheck
:type
@@ -168,8 +170,18 @@ An example contents of the `wcheck-language-data' variable:
(const :tag "Program: " :format "%t" program)
(file :format "%v"))
(cons :tag "Arguments" :format "%v"
- (const :tag "Arguments: " :format "%t" args)
- (string :format "%v"))
+ (const :format "" args)
+ (repeat :tag "Arguments"
+ :value-to-internal
+ (lambda (widget value)
+ (cond ((stringp value)
+ (split-string-and-unquote value "[ \t\n]+"))
+ ((listp value)
+ value)))
+ :match (lambda (widget value)
+ (or (listp value)
+ (stringp value)))
+ (string :format "%v")))
(cons :tag "Connection type" :format "%v"
(const :tag "Connection type: " :format "%t" connection)
(choice :format "%[Value Menu%] %v" :value nil
@@ -204,7 +216,7 @@ An example contents of the `wcheck-language-data' variable:
(defconst wcheck-language-data-defaults
- '((args . "")
+ '((args . nil)
(connection . nil)
(face . wcheck-default-face)
(syntax . text-mode-syntax-table)
@@ -679,9 +691,7 @@ operation was unsuccessful."
;; It doesn't exist so start a new one.
(let* ((language (wcheck-get-data :buffer buffer :language))
(program (wcheck-query-language-data language 'program))
- (args (split-string-and-unquote
- (wcheck-query-language-data language 'args t)
- "[ \t\n]+"))
+ (args (wcheck-query-language-data language 'args t))
(process-connection-type
(wcheck-query-language-data language 'connection t))
proc)
@@ -879,16 +889,23 @@ defined in `wcheck-language-data-defaults'."
((eq key 'syntax)
(if (syntax-table-p (and (boundp value)
(eval value)))
- value default-value))
+ value
+ default-value))
((eq key 'face)
(if (facep value) value default-value))
((or (eq key 'program)
- (eq key 'args)
(eq key 'regexp-start)
(eq key 'regexp-body)
(eq key 'regexp-end)
(eq key 'regexp-discard))
(if (stringp value) value default-value))
+ ((eq key 'args)
+ (cond ((listp value)
+ value)
+ ((stringp value)
+ ;; For backwards compatibility
+ (split-string-and-unquote value "[ \t\n]+"))
+ (t default-value)))
((or (eq key 'connection)
(eq key 'case-fold))
value))))
- [elpa] 320/352: Remove version information from wcheck-mode.el, (continued)
- [elpa] 320/352: Remove version information from wcheck-mode.el, Stefan Monnier, 2014/07/07
- [elpa] 124/352: Tehostetaan sanojen lukemista, Stefan Monnier, 2014/07/07
- [elpa] 302/352: Clarify that wcheck-mode is a minor mode, Stefan Monnier, 2014/07/07
- [elpa] 119/352: Pienennetään wcheck-moden reagointiviivettä 0,4 sekuntiin, Stefan Monnier, 2014/07/07
- [elpa] 305/352: Don't mention "Aspell" in the documentation, Stefan Monnier, 2014/07/07
- [elpa] 214/352: Lisää virheenkäsittely condition-case-rakenteella, Stefan Monnier, 2014/07/07
- [elpa] 301/352: Add (regexp-discard . "") to email detect example, Stefan Monnier, 2014/07/07
- [elpa] 149/352: Kielellistä hienosäätöä funktioiden kuvauksissa, Stefan Monnier, 2014/07/07
- [elpa] 158/352: Uusi ominaisuus: korjausehdotukset väärinkirjoitetuille sanoille, Stefan Monnier, 2014/07/07
- [elpa] 161/352: Muutetaan jäsenninfunktion nimi: wcheck-parse-suggestions-lines, Stefan Monnier, 2014/07/07
- [elpa] 144/352: Muutetaan ulkoisen ohjelman argumentit listaksi,
Stefan Monnier <=
- [elpa] 162/352: Hiotaan dokumentteja ja merkkijonoja, Stefan Monnier, 2014/07/07
- [elpa] 312/352: Use COPY-SEQUENCE instead of COPY-TREE, Stefan Monnier, 2014/07/07
- [elpa] 308/352: Fix a small typo in README, Stefan Monnier, 2014/07/07
- [elpa] 318/352: Update copyright year in README, Stefan Monnier, 2014/07/07
- [elpa] 273/352: More accurate description for OPERATION-MODE of read-or-skip-faces, Stefan Monnier, 2014/07/07
- [elpa] 274/352: Minor rephrasing in README, Stefan Monnier, 2014/07/07
- [elpa] 292/352: Change README to README.org in a doc string, Stefan Monnier, 2014/07/07
- [elpa] 257/352: Use plural "actions" with the install instruction's autoload, Stefan Monnier, 2014/07/07
- [elpa] 314/352: Add variable and interactive function wcheck-version, Stefan Monnier, 2014/07/07
- [elpa] 160/352: Hiotaan tekstipohjaista oikolukuehdotusvalikkoa, Stefan Monnier, 2014/07/07