Browse Source

Update head

master
10sr 6 years ago
parent
commit
d0a4292264
Signed by: 10sr GPG Key ID: 7BEC428194130EB2
1 changed files with 13 additions and 10 deletions
  1. +13
    -10
      emacs.el

+ 13
- 10
emacs.el View File

@@ -1,6 +1,6 @@
;;; emacs.el --- 10sr emacs initialization ;;; emacs.el --- 10sr emacs initialization


;; Time-stamp: <2018-10-09 15:15:44 JST 10sr>
;; Time-stamp: <2018-10-09 16:36:20 JST 10sr>


;;; Code: ;;; Code:


@@ -1324,22 +1324,25 @@ found, otherwise returns nil."


(defun my-file-head (filename &optional n) (defun my-file-head (filename &optional n)
"Return list of first N lines of file FILENAME." "Return list of first N lines of file FILENAME."
;; Work with japanese text?
;; TODO: Fix for janapese text
;; TODO: Fix for short text
(let ((num (or n 10)) (let ((num (or n 10))
(size 100) (size 100)
(beg 0) (beg 0)
(end 0) (end 0)
(result '()))
(result '())
(read -1))
(with-temp-buffer (with-temp-buffer
(erase-buffer) (erase-buffer)
(while (<= (count-lines (point-min)
(point-max))
num)
(while (or (<= (count-lines (point-min)
(point-max))
num)
(eq read 0))
(setq end (+ beg size)) (setq end (+ beg size))
(insert-file-contents-literally filename
nil
beg
end)
(setq read (nth 1 (insert-file-contents-literally filename
nil
beg
end)))
(goto-char (point-max)) (goto-char (point-max))
(setq beg (+ beg size))) (setq beg (+ beg size)))
(goto-char (point-min)) (goto-char (point-min))


Loading…
Cancel
Save