# emacs如何快速的产生一个数字序列？

``````(number-sequence 0 9)
;=> (0 1 2 3 4 5 6 7 8 9)
``````

Why not excemacs(

Emaxcel 更顺口一点

Excaliburemas

2 个赞

2 个赞

`eval-print-last-sexp`?

1 个赞

``````| Student  | Maths | Physics | Mean |
|----------+-------+---------+------|
| Bertrand |    13 |      09 |      |
| Henri    |    15 |      14 |      |
| Arnold   |    17 |      13 |      |
#+TBLFM: \$4=vmean(\$2..\$3)
``````

``````| Student  | Maths | Physics | Mean |
|----------+-------+---------+------|
| Bertrand |    13 |      09 |   11 |
| Henri    |    15 |      14 | 14.5 |
| Arnold   |    17 |      13 |   15 |
#+TBLFM: \$4=vmean(\$2..\$3)
``````
3 个赞

``````;; test
;; m4,8*2x|*** TODO http://emacsrocks.com/e%02d.html
;; 67

(defun left-number ()
(save-excursion
(goto-char (line-end-position))
(while (looking-back "\s") (left-char 1))
(sexp-at-point)))

(defvar tiny-mapconcat-1 nil "")

(defun tiny-mapconcat-1 ()
""
(let ((parsed (tiny-mapconcat-parse)))
(if  parsed
(setq tiny-mapconcat-1
(let* ((expr (or (nth 3 parsed) "x"))
(n-have (if (and (listp lexpr) (eq (car lexpr) 'list))
(1- (length lexpr))
0))
(expr (if (zerop n-have) `(list ,lexpr) lexpr))
(n-have (if (zerop n-have) 1 n-have))
(tes (tiny-extract-sexps (or (nth 4 parsed) " %s")))
(fmt (car tes))
(idx -1)
)
`(let* ((x (left-number))(lst ,expr))
(format ,(tiny--strip-\n fmt)
,@(mapcar (lambda (x)
(if x
(if (>= (1+ idx) n-have)
'x
`(nth ,(incf idx) lst))))
(cdr tes))))))
(when tiny-mapconcat-1
(insert (eval tiny-mapconcat-1)))
)))

(defun tiny-expand1 ()
(interactive)
(tiny-mapconcat-1)
(lie-move 1)
(goto-char (line-end-position))
)
``````