Better use of litterate programming
This commit is contained in:
parent
7dc74ae0ac
commit
fe5e3de04c
@ -904,30 +904,36 @@
|
||||
- Clientkey :: whether this should be a global shortcut or a shortcut only
|
||||
aimed at clients (value is ~yes~ or ~no~)
|
||||
|
||||
#+NAME: gen-sc-glob
|
||||
#+BEGIN_SRC emacs-lisp :var table=sc-client
|
||||
(mapconcat (lambda (x)
|
||||
#+NAME: gen-sc-text
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(lambda (x)
|
||||
(format "awful.key({%s},\"%s\",%s,\n\t{description=\"%s\",group=\"%s\"})"
|
||||
(nth 1 x) (nth 0 x)
|
||||
(if (string= "yes" (nth 2 x))
|
||||
(format "function() %s end" (nth 3 x))
|
||||
(nth 3 x))
|
||||
(cond
|
||||
((string= "yes" (nth 2 x))
|
||||
(format "function() %s end" (nth 3 x)))
|
||||
((string= "shell" (nth 2 x))
|
||||
(format "awful.spawn.with_shell(\"%s\")" (nth 3 x)))
|
||||
(t (nth 3 x)))
|
||||
(nth 4 x) (nth 5 x)))
|
||||
|
||||
#+END_SRC
|
||||
|
||||
#+NAME: gen-sc-glob
|
||||
#+BEGIN_SRC emacs-lisp :var table=sc-client
|
||||
(mapconcat
|
||||
<<gen-sc-text>>
|
||||
(seq-filter (lambda (x)
|
||||
(not (string= "yes" (nth 6 x))))
|
||||
(or (not (nth 6 x))
|
||||
(string= "no" (nth 6 x))))
|
||||
table)
|
||||
",\n")
|
||||
#+END_SRC
|
||||
|
||||
#+NAME: gen-sc-client
|
||||
#+BEGIN_SRC emacs-lisp :var table=sc-client
|
||||
(mapconcat (lambda (x)
|
||||
(format "awful.key({%s},\"%s\",%s,\n\t{description=\"%s\",group=\"%s\"})"
|
||||
(nth 1 x) (nth 0 x)
|
||||
(if (string= "yes" (nth 2 x))
|
||||
(format "function(c) %s end" (nth 3 x))
|
||||
(nth 3 x))
|
||||
(nth 4 x) (nth 5 x)))
|
||||
(mapconcat
|
||||
<<gen-sc-text>>
|
||||
(seq-filter (lambda (x)
|
||||
(string= "yes" (nth 6 x)))
|
||||
table)
|
||||
@ -940,8 +946,10 @@
|
||||
(dotimes (i 10 result)
|
||||
(let* ((j (+ 1 i)))
|
||||
(setq result
|
||||
(cons (mapconcat (lambda (line)
|
||||
(format "awful.key({%s},\"#%d\",function() %s%d) end,\n\t{description=\"%s%d\",tag=\"%s\"})"
|
||||
(cons (mapconcat
|
||||
(lambda (line)
|
||||
(format
|
||||
"awful.key({%s},\"#%d\",function() %s%d) end,\n\t{description=\"%s%d\",tag=\"%s\"})"
|
||||
(nth 1 line) (+ j 9) (nth 2 line) j (nth 3 line) j (nth 4 line)))
|
||||
input
|
||||
",\n")
|
||||
|
Loading…
Reference in New Issue
Block a user