Skip to content

Commit

Permalink
Revert "remove some yank related cruft, make yank/pop work same withi…
Browse files Browse the repository at this point in the history
…n box or not"

This reverts commit f01ebcc.

Conflicts:

	rebox2.el
  • Loading branch information
Le Wang committed Jul 9, 2012
1 parent d15248a commit 9e7e2cd
Showing 1 changed file with 34 additions and 25 deletions.
59 changes: 34 additions & 25 deletions rebox2.el
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@


;; Created: Mon Jan 10 22:22:32 2011 (+0800) ;; Created: Mon Jan 10 22:22:32 2011 (+0800)
;; Version: 0.7 ;; Version: 0.7
;; Last-Updated: Mon Jul 9 23:00:46 2012 (+0800) ;; Last-Updated: Mon Jul 9 23:04:40 2012 (+0800)
;; By: Le Wang ;; By: Le Wang
;; Update #: 436 ;; Update #: 437
;; URL: https://github.com/lewang/rebox2 ;; URL: https://github.com/lewang/rebox2
;; Keywords: ;; Keywords:
;; Compatibility: GNU Emacs 23.2 ;; Compatibility: GNU Emacs 23.2
Expand Down Expand Up @@ -737,6 +737,17 @@ lines in the body of box."
:type 'symbol :type 'symbol
:group 'rebox) :group 'rebox)



(defcustom rebox-yank-function 'yank
"function called by `rebox-yank' when no box is found."
:type 'symbol
:group 'rebox)

(defcustom rebox-yank-pop-function 'yank-pop
"function called by `rebox-yank-pop' when no box is found."
:type 'symbol
:group 'rebox)

(defcustom rebox-newline-indent-function-alist (defcustom rebox-newline-indent-function-alist
'((c-mode . c-indent-new-comment-line) '((c-mode . c-indent-new-comment-line)
(c++-mode . c-indent-new-comment-line) (c++-mode . c-indent-new-comment-line)
Expand Down Expand Up @@ -1252,7 +1263,7 @@ If style isn't found return first style."
(+ (length (rebox-make-fill-prefix)) (+ (length (rebox-make-fill-prefix))
unindent-count))))) unindent-count)))))
(throw 'rebox-engine-done t))) (throw 'rebox-engine-done t)))
(goto-char orig-m) (goto-char orig-m)
(if (or (bolp) (if (or (bolp)
(> (current-column) boxed-line-start-col)) (> (current-column) boxed-line-start-col))
(move-to-column boxed-line-start-col) (move-to-column boxed-line-start-col)
Expand Down Expand Up @@ -1389,15 +1400,14 @@ call fallback. With 1+ universal arg, pass (n-1) args to fallback.\n\n"


(defun rebox-yank (arg) (defun rebox-yank (arg)
(interactive "P*") (interactive "P*")
(let ((fallback (call-interactively 'yank))) (rebox-kill-yank-wrapper :not-at-nw t
(rebox-kill-yank-wrapper :not-at-nw t :mod-func
:mod-func (lambda ()
(lambda () (goto-char orig-m)
(goto-char orig-m) (call-interactively 'yank)
fallback (set-marker orig-m (point)))
(set-marker orig-m (point))) :orig-func
:orig-func (rebox-get-fallback 'rebox-yank-function)))
fallback)))
(put 'rebox-yank 'function-documentation (put 'rebox-yank 'function-documentation
'(concat '(concat
"Rebox behaviour: yank content into box. With universal ARG, always "Rebox behaviour: yank content into box. With universal ARG, always
Expand All @@ -1408,15 +1418,14 @@ To pass universal ARG to fall-back function, use C-u C-u."


(defun rebox-yank-pop (arg) (defun rebox-yank-pop (arg)
(interactive "P*") (interactive "P*")
(let ((fallback )) (rebox-kill-yank-wrapper :not-at-nw t
(rebox-kill-yank-wrapper :not-at-nw t :mod-func
:mod-func (lambda ()
(lambda () (goto-char orig-m)
(goto-char orig-m) (call-interactively 'yank-pop)
(call-interactively fallback) (set-marker orig-m (point)))
(set-marker orig-m (point))) :orig-func
:orig-func (rebox-get-fallback 'rebox-yank-pop-function)))
fallback)))
(put 'rebox-yank-pop 'function-documentation (put 'rebox-yank-pop 'function-documentation
'(concat '(concat
"Rebox behaviour: yank-pop without box. With universal arg, "Rebox behaviour: yank-pop without box. With universal arg,
Expand Down Expand Up @@ -1734,11 +1743,11 @@ With numeric arg, use explicit style.
(rebox-find-and-narrow :comment-only comment-auto-fill-only-comments (rebox-find-and-narrow :comment-only comment-auto-fill-only-comments
:try-whole-box try-whole-box) :try-whole-box try-whole-box)
(when (and (when (and
not-at-nw
(progn (progn
(goto-char (point-min)) (goto-char (point-min))
(skip-syntax-forward " " orig-m) (skip-syntax-forward " " orig-m)
(= (point) orig-m))) (= (point) orig-m))
not-at-nw)
(signal 'rebox-error '("mark is out of box"))) (signal 'rebox-error '("mark is out of box")))
(when (and (= orig-m (point-max)) (when (and (= orig-m (point-max))
(progn (progn
Expand Down Expand Up @@ -2005,9 +2014,9 @@ The narrowed buffer should contain only whole lines, otherwise it will look stra
(let ((marked-col (progn (let ((marked-col (progn
;; bug # 7946 workaround ;; bug # 7946 workaround
;; should be fixed in next emacs23 release after 23.2.1 ;; should be fixed in next emacs23 release after 23.2.1
(set-buffer (current-buffer)) (set-buffer (current-buffer))
(format "%s" marked-point) (format "%s" marked-point)
(goto-char marked-point) (goto-char marked-point)
(current-column)))) (current-column))))
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "^[ \t][ \t]+" nil t) (while (re-search-forward "^[ \t][ \t]+" nil t)
Expand Down

0 comments on commit 9e7e2cd

Please sign in to comment.