;;; Code:
-(require 'cl)
+(eval-when-compile
+ (require 'cl))
+
(require 'egg-edep)
(defgroup its nil
:group 'its :type 'boolean)
(defcustom its-delete-by-keystroke nil
- "*Delete characters as if cancel input keystroke, if nin-NIL."
+ "*Delete characters as if cancel input keystroke, if nin-NIL.
+This variable is overriden by `its-delete-by-character'."
+ :group 'its :type 'boolean)
+
+(defcustom its-delete-by-character nil
+ "*Delete a character as a unit even if just after input, if nin-NIL.
+This variable override `its-delete-by-keystroke'."
:group 'its :type 'boolean)
(defcustom its-fence-invisible nil
(make-variable-buffer-local 'its-previous-select-func)
(put 'its-previous-select-func 'permanent-local t)
-(defvar its-current-language)
+(defvar its-current-language nil)
(make-variable-buffer-local 'its-current-language)
(put 'its-current-language 'permanent-local t)
\f
(if (consp (cdr syl))
(cons (its-get-output syl) (its-get-keyseq-syl syl))
syl))
-
+
;;
;;
(define-key map "\M-y" 'its-yank-pop)
(define-key map [backspace] 'its-delete-backward-SYL)
(define-key map [delete] 'its-delete-backward-SYL)
- (define-key map [M-backspace] 'its-delete-backward-SYL-by-keystroke)
- (define-key map [M-delete] 'its-delete-backward-SYL-by-keystroke)
+ (define-key map [(meta backspace)] 'its-delete-backward-SYL-by-keystroke)
+ (define-key map [(meta delete)] 'its-delete-backward-SYL-by-keystroke)
(define-key map [right] 'its-forward-SYL)
(define-key map [left] 'its-backward-SYL)
(while (< i 127)
(let ((p (point))
(str (copy-sequence "!")))
(set-text-properties 0 1 (list 'read-only t
- 'invisible t
+ 'invisible 'egg
'intangible 'its-part-2
'its-cursor cursor
'point-entered 'egg-enter/leave-fence
(error "invalid fence"))
;; Put open-fence before inhibit-read-only to detect read-only
(insert (if its-context its-fence-continue its-fence-open))
+ (egg-setup-invisibility-spec)
(let ((inhibit-read-only t))
(setq p1 (point))
(add-text-properties p p1 open-props)
(insert its-fence-close)
(add-text-properties p1 (point) close-props)
(if its-fence-invisible
- (put-text-property p (point) 'invisible t))
+ (put-text-property p (point) 'invisible 'egg))
(put-text-property p (point) 'read-only t)
(goto-char p1)
(its-define-select-keys its-mode-map t)
(setq state next-state))
((null build-if-none)
(error "No such state (%s)" input))
- (t
+ (t
(if (not (or brand-new (= i 1) (its-get-kst/t state)))
(its-set-interim-terminal-state state))
(setq state (its-make-next-state state key
(cursor (get-text-property (point) 'its-cursor)))
(if (null syl)
(signal 'beginning-of-buffer nil)
- (if (eq cursor t)
+ (if (or (eq cursor t) (and cursor its-delete-by-character))
(its-delete-backward-SYL-internal n killflag)
(its-delete-backward-within-SYL syl n killflag)))))
(signal 'beginning-of-buffer nil))
(delete-region p (point))
(if (> len n)
- (its-state-machine-keyseq (substring keyseq 0 (- len n))
+ (its-state-machine-keyseq (substring keyseq 0 (- len n))
'its-buffer-ins/del-SYL)
(its-set-cursor-status
(if (or (null its-delete-by-keystroke)
(princ (documentation 'its-mode))
(help-setup-xref (cons #'help-xref-mode (current-buffer)) (interactive-p))))
+;; The `point-left' hook function will never be called in Emacs 21.2.50
+;; when the command `next-line' is used in the last line of a buffer
+;; which isn't terminated with a newline or the command `previous-line'
+;; is used in the first line of a buffer.
+(defun its-next-line (&optional arg)
+ "Go to the end of the line if the line isn't terminated with a newline,
+otherwise run `next-line' as usual."
+ (interactive "p")
+ (if (= (line-end-position) (point-max))
+ (end-of-line)
+ (next-line arg)))
+
+(defun its-previous-line (&optional arg)
+ "Go to the beginning of the line if it is called in the first line of a
+buffer, otherwise run `previous-line' as usual."
+ (interactive "p")
+ (if (= (line-beginning-position) (point-mim))
+ (beginning-of-line)
+ (previous-line arg)))
+
+(substitute-key-definition 'next-line 'its-next-line
+ its-mode-map global-map)
+(substitute-key-definition 'previous-line 'its-previous-line
+ its-mode-map global-map)
+
(provide 'its)
-;;; its.el ends here.
+
+;;; its.el ends here