commit:     960a580d531793678bdb407b8fee58ea538993a8
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 19 07:00:25 2014 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Fri Dec 19 07:00:25 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/emacs-tools.git;a=commit;h=960a580d

Special case etags only in the update action.

* ctags.eselect (find_targets, do_update): Have a special case for
etags only in the update action. Otherwise, display all targets
for it, even if no Emacs variant is installed.
* ctags.eselect.5: Update.

---
 ChangeLog       |  7 +++++++
 ctags.eselect   | 13 ++++++-------
 ctags.eselect.5 |  6 +++---
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 71547e6..135fca4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-12-19  Ulrich Müller  <[email protected]>
+
+       * ctags.eselect (find_targets, do_update): Have a special case for
+       etags only in the update action. Otherwise, display all targets
+       for it, even if no Emacs variant is installed.
+       * ctags.eselect.5: Update.
+
 2014-10-28  Ulrich Müller  <[email protected]>
 
        * Version 1.17 released.

diff --git a/ctags.eselect b/ctags.eselect
index 5325536..8384e16 100644
--- a/ctags.eselect
+++ b/ctags.eselect
@@ -40,12 +40,6 @@ find_targets() {
                [[ -f ${EROOT}/usr/bin/${CTAGS}-${emacs} ]] && echo 
"${CTAGS}-${emacs}"
        elif [[ -f ${EROOT}/usr/bin/xemacs ]]; then
                [[ -f ${EROOT}/usr/bin/${CTAGS}-xemacs ]] && echo 
"${CTAGS}-xemacs"
-       elif [[ ${CTAGS} = etags ]]; then
-               # We are called as etags module, but no (X)Emacs is installed.
-               # Return an empty list in this case, because we don't want
-               # exuberant-ctags as default for etags (for ctags it's fine).
-               # Also, vi purists wouldn't want an etags symlink.
-               return
        fi
 
        # Exuberant ctags
@@ -215,7 +209,12 @@ do_update() {
                # offers several concurrent versions.
 
                local i target targets=( $(find_targets) )
-               if [[ ${#targets[@]} -gt 0 && ${current} != nolink ]]; then
+               # We don't want exuberant-ctags as default for etags. Also, vi
+               # purists wouldn't want an etags symlink. Therefore, don't 
update
+               # the etags symlink unless there is an (X)Emacs provider.
+               if [[ ${#targets[@]} -gt 0 && ${current} != nolink ]] \
+                       && ! [[ ${CTAGS} = etags && ${targets[0]} != 
${CTAGS}-*emacs* ]]
+               then
                        target=${targets[0]}
                        [[ ${current} = ${CTAGS}-*emacs* ]] && 
current=${CTAGS}-*emacs*
                        for i in ${targets[@]}; do

diff --git a/ctags.eselect.5 b/ctags.eselect.5
index 88da8ed..bcdb55b 100644
--- a/ctags.eselect.5
+++ b/ctags.eselect.5
@@ -89,9 +89,9 @@ is a real binary, owned by package freebsd-ubin.
 .RB ( "eselect etags"
 does work though.)
 
-.B eselect etags
-does not display any valid targets if there is no Emacs variant
-installed.  This is a feature.
+.B eselect etags update
+does not update the target if there is no Emacs variant installed.
+This is a feature.
 .SH AUTHOR
 Ulrich Müller <[email protected]>
 .SH SEE ALSO

Reply via email to