Skip to content

Commit

Permalink
Not configure with pophint-region:kill-ring-save-p but define each co…
Browse files Browse the repository at this point in the history
…mmand
  • Loading branch information
aki2o committed Apr 10, 2020
1 parent 2c43423 commit 4f6bbea
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 28 deletions.
61 changes: 34 additions & 27 deletions pophint-region.el
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
(require 'pophint)

(defcustom pophint-region:kill-ring-save-p t
"Whether to save into kill ring by `pophint-region:kill'/`pophint-region:backward-kill'."
:type 'boolean
:group 'pophint)
(make-obsolete 'pophint-config:set-kill-region-kill-ring-save 'pophint-region:kill-ring-save-p "1.1.0")

(defvar pophint-region--start nil)
(defvar pophint-region--end nil)
(defvar pophint-region--user-start nil)
Expand Down Expand Up @@ -69,35 +63,48 @@

;;;###autoload
(defun pophint-region:kill ()
"Kill/Delete region by selecting hint-tip."
"Kill region by selecting hint-tip."
(interactive)
(lexical-let ((func (if pophint-region:kill-ring-save-p
'kill-region
'delete-region)))
(pophint-region:narrow-or-wide
:narrow-limit (point-at-eol)
:use-pos-tip t
:action-name (symbol-name func)
:action (lambda (hint)
(funcall func (point) (pophint:hint-startpt hint))))))
(pophint-region:narrow-or-wide
:narrow-limit (point-at-eol)
:use-pos-tip t
:action-name "kill-region"
:action (lambda (hint) (kill-region (point) (pophint:hint-startpt hint)))))
(define-obsolete-function-alias 'pophint-config:kill-region 'pophint-region:kill "1.1.0")

;;;###autoload
(defun pophint-region:backward-kill ()
"Kill/Delete region by selecting hint-tip."
"Kill region by selecting hint-tip."
(interactive)
(lexical-let ((func (if pophint-region:kill-ring-save-p
'kill-region
'delete-region)))
(pophint-region:narrow-or-wide
:backward-p t
:narrow-limit (point-at-bol)
:use-pos-tip t
:action-name (symbol-name func)
:action (lambda (hint)
(funcall func (pophint:hint-startpt hint) (point))))))
(pophint-region:narrow-or-wide
:backward-p t
:narrow-limit (point-at-bol)
:use-pos-tip t
:action-name "kill-region"
:action (lambda (hint) (kill-region (pophint:hint-startpt hint) (point)))))
(define-obsolete-function-alias 'pophint-config:backward-kill-region 'pophint-region:backward-kill "1.1.0")

;;;###autoload
(defun pophint-region:delete ()
"Delete region by selecting hint-tip."
(interactive)
(pophint-region:narrow-or-wide
:narrow-limit (point-at-eol)
:use-pos-tip t
:action-name "delete-region"
:action (lambda (hint) (delete-region (point) (pophint:hint-startpt hint)))))

;;;###autoload
(defun pophint-region:backward-delete ()
"Delete region by selecting hint-tip."
(interactive)
(pophint-region:narrow-or-wide
:backward-p t
:narrow-limit (point-at-bol)
:use-pos-tip t
:action-name "delete-region"
:action (lambda (hint) (delete-region (pophint:hint-startpt hint) (point)))))


(provide 'pophint-region)
;;; pophint-region.el ends here
2 changes: 1 addition & 1 deletion pophint.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
;; Author: Hiroaki Otsu <ootsuhiroaki@gmail.com>
;; Keywords: popup
;; URL: https://github.com/aki2o/emacs-pophint
;; Version: 1.1.0
;; Version: 1.1.1
;; Package-Requires: ((log4e "0.2.0") (yaxception "0.3"))

;; This program is free software; you can redistribute it and/or modify
Expand Down

0 comments on commit 4f6bbea

Please sign in to comment.