diff options
author | Leo Liu <sdl.web@gmail.com> | 2016-06-25 09:35:39 +0800 |
---|---|---|
committer | Leo Liu <sdl.web@gmail.com> | 2016-06-25 09:49:16 +0800 |
commit | 852507f147b4253a8ec265951b70229cfd7c5a64 (patch) | |
tree | b9569ef06a6e565d50442b723b06a0dbddb7634c /lisp/progmodes/prolog.el | |
parent | d590048bed8466e84c66d60f35df236d0ff8e81b (diff) | |
download | emacs-852507f147b4253a8ec265951b70229cfd7c5a64.tar.gz |
Use use-region-p in prolog.el
* lisp/progmodes/prolog.el (region-exists-p): Remove.
* lisp/progmodes/prolog.el (prolog-edit-menu-runtime,
prolog-edit-menu-insert-move): Use use-region-p.
Diffstat (limited to 'lisp/progmodes/prolog.el')
-rw-r--r-- | lisp/progmodes/prolog.el | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 0bbf67fd37b..2b23c51a114 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -271,6 +271,9 @@ (require 'easymenu) (require 'align) +(eval-when-compile + (or (fboundp 'use-region-p) + (defsubst use-region-p () (region-exists-p)))) (defgroup prolog nil "Editing and running Prolog and Mercury files." @@ -3329,12 +3332,6 @@ PREFIX is the prefix of the search regexp." ;; prolog buffer) ;;------------------------------------------------------------------- -(unless (fboundp 'region-exists-p) - (defun region-exists-p () - "Non-nil if the mark is set. Lobotomized version for Emacsen that do not provide their own." - (mark))) - - ;; GNU Emacs ignores `easy-menu-add' so the order in which the menus ;; are defined _is_ important! @@ -3368,7 +3365,7 @@ PREFIX is the prefix of the search regexp." :included (not (eq prolog-system 'mercury))] ["Consult buffer" prolog-consult-buffer :included (not (eq prolog-system 'mercury))] - ["Consult region" prolog-consult-region :active (region-exists-p) + ["Consult region" prolog-consult-region :active (use-region-p) :included (not (eq prolog-system 'mercury))] ["Consult predicate" prolog-consult-predicate :included (not (eq prolog-system 'mercury))] @@ -3380,7 +3377,7 @@ PREFIX is the prefix of the search regexp." :included (eq prolog-system 'sicstus)] ["Compile buffer" prolog-compile-buffer :included (eq prolog-system 'sicstus)] - ["Compile region" prolog-compile-region :active (region-exists-p) + ["Compile region" prolog-compile-region :active (use-region-p) :included (eq prolog-system 'sicstus)] ["Compile predicate" prolog-compile-predicate :included (eq prolog-system 'sicstus)] @@ -3418,11 +3415,11 @@ PREFIX is the prefix of the search regexp." prolog-edit-menu-insert-move prolog-mode-map "Commands for Prolog code manipulation." '("Prolog" - ["Comment region" comment-region (region-exists-p)] - ["Uncomment region" prolog-uncomment-region (region-exists-p)] + ["Comment region" comment-region (use-region-p)] + ["Uncomment region" prolog-uncomment-region (use-region-p)] ["Add comment/move to comment" indent-for-comment t] ["Convert variables in region to '_'" prolog-variables-to-anonymous - :active (region-exists-p) :included (not (eq prolog-system 'mercury))] + :active (use-region-p) :included (not (eq prolog-system 'mercury))] "---" ["Insert predicate template" prolog-insert-predicate-template t] ["Insert next clause head" prolog-insert-next-clause t] @@ -3435,10 +3432,10 @@ PREFIX is the prefix of the search regexp." ["End of predicate" prolog-end-of-predicate t] "---" ["Indent line" indent-according-to-mode t] - ["Indent region" indent-region (region-exists-p)] + ["Indent region" indent-region (use-region-p)] ["Indent predicate" prolog-indent-predicate t] ["Indent buffer" prolog-indent-buffer t] - ["Align region" align (region-exists-p)] + ["Align region" align (use-region-p)] "---" ["Mark clause" prolog-mark-clause t] ["Mark predicate" prolog-mark-predicate t] |