Browse Source

add ilookup--on-prompt-p and remove comments

pull/1/head
10sr 10 years ago
parent
commit
2af118065b
1 changed files with 9 additions and 12 deletions
  1. +9
    -12
      emacs.el

+ 9
- 12
emacs.el View File

@@ -2331,12 +2331,7 @@ this is test, does not rename files."




;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; isdcv

;; TODO: remove dependant of sdcv, and change the name to something like
;; `ilookup`

;; TODO: enter to lookup word at point
;; ilookup


(defvar ilookup-prompt ">>> " (defvar ilookup-prompt ">>> "
"Prompt string for ilookup input.") "Prompt string for ilookup input.")
@@ -2367,8 +2362,7 @@ Freeze current input and show next prompt."
(interactive) (interactive)
(let ((pword (and (let ((pword (and
;; do not get if currently on prompt ;; do not get if currently on prompt
(not (eq (line-number-at-pos)
(line-number-at-pos ilookup-current-prompt-point)))
(not (ilookup--on-prompt-p))
(thing-at-point 'word)))) (thing-at-point 'word))))
;; print result is done only when currently on prompt ;; print result is done only when currently on prompt
(ilookup--print-result-from-input) (ilookup--print-result-from-input)
@@ -2518,8 +2512,7 @@ This function insert newline if required."
(save-excursion (save-excursion
(goto-char ilookup-current-prompt-point) (goto-char ilookup-current-prompt-point)
(forward-line 1) (forward-line 1)
(when (eq (line-number-at-pos)
(line-number-at-pos ilookup-current-prompt-point))
(when (ilookup--on-prompt-p)
(end-of-line) (end-of-line)
(newline)) (newline))
(point-at-bol)))) (point-at-bol))))
@@ -2569,11 +2562,15 @@ This function insert newline if required."
Return nil if current position is not on prompt line." Return nil if current position is not on prompt line."
(and (eq ilookup-buffer (and (eq ilookup-buffer
(current-buffer)) (current-buffer))
(eq (line-number-at-pos)
(line-number-at-pos ilookup-current-prompt-point))
(ilookup--on-prompt-p)
(buffer-substring-no-properties (ilookup-bol) (buffer-substring-no-properties (ilookup-bol)
(point-at-eol)))) (point-at-eol))))


(defsubst ilookup--on-prompt-p ()
"Return true if currently on prompt line."
(eq (line-number-at-pos)
(line-number-at-pos ilookup-current-prompt-point)))

(defun ilookup-open () (defun ilookup-open ()
"Open ilookup buffer." "Open ilookup buffer."
(interactive) (interactive)


Loading…
Cancel
Save