leoliu / ggtags

Emacs frontend to GNU Global source code tagging system.
http://elpa.gnu.org
578 stars 56 forks source link

global: only name char is allowed with -c option. #191

Open sergeyklay opened 5 years ago

sergeyklay commented 5 years ago

Hello,

Just catched this error:

Debugger entered--Lisp error: (error "‘global’ non-zero exit: global: only name char is allowed with -c option.")
  signal(error ("‘global’ non-zero exit: global: only name char is allowed with -c option."))
  error("`%s' non-zero exit: %s" "global" "global: only name char is allowed with -c option.")
  ggtags-process-string("global" "-c" "?-")
  apply(ggtags-process-string "global" ("-c" "?-"))
  #f(compiled-function (prefix) #<bytecode 0xf912a9>)("?-")
  #f(compiled-function (string pred action) #<bytecode 0xfdc4e9>)("?-" nil lambda)
  test-completion("?-" #f(compiled-function (string pred action) #<bytecode 0xfdc4e9>))
  ggtags-highlight-tag-at-point()
  apply(ggtags-highlight-tag-at-point nil)
  timer-event-handler([t 0 0 250000 t ggtags-highlight-tag-at-point nil idle 0])

My cursor was here (between ? and -)

(while (and (> (length line-txt) 0) (= (aref line-txt 0) ?- ) )
;;                                                        ^
;;                                                        |
;; -------------------------------------------------------┘
$ ctags --version
Exuberant Ctags 5.9~svn20110310, Copyright (C) 1996-2009 Darren Hiebert
  Addresses: <dhiebert@users.sourceforge.net>, http://ctags.sourceforge.net
  Optional compiled features: +wildcards, +regex
$ emacs --version
GNU Emacs 26.1
Copyright (C) 2018 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
$ global --version
global (GNU GLOBAL) 6.6.3
Powered by Berkeley DB 1.85.
Copyright (c) 1996-2018 Tama Communications Corporation
License GPLv3+: GNU GPL version 3 or later <http://www.gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Configuration:

(when (executable-find "global")
  (use-package ggtags
    :delight " gg"
    :bind
    (:map ggtags-mode-map
          ("C-c g s" . 'ggtags-find-other-symbol)
          ("C-c g h" . 'ggtags-view-tag-history)
          ("C-c g r" . 'ggtags-find-reference)
          ("C-c g f" . 'ggtags-find-file)
          ("C-c g c" . 'ggtags-create-tags)
          ("C-c g u" . 'ggtags-update-tags)
          ("M-."     . 'ggtags-find-tag-dwim)
          ("M-,"     . 'pop-tag-mark)
          ("M-]"     . nil)
          ("C-c <"   . 'ggtags-prev-mark)
          ("C-c >"   . 'ggtags-next-mark))
    :config
    (progn
      (dolist (hook '(php-mode-hook
                      sh-mode-hook
                      c-mode-hook
                      c++-mode-hook
                      makefile-mode-hook
                      emacs-lisp-mode-hook))
        (add-hook hook #'ggtags-mode)))))

ggtags version 20190320.2208 (MELPA)

leoliu commented 5 years ago

Basically gnu global -c only accepts chars that are not regex meta chars. Thus ignore-errors-unless-debug is used to turn such error into a message instead.

sergeyklay commented 5 years ago

I don't want to hide or ignore errors and don't consider this as an acceptable approach in software development. In addition, I need the debug mode for my other tasks.

leoliu commented 5 years ago

The real bug is in GNU global. Kindly raise the issue there and with some luck someone may fix it the next day. It seems to me there is no reason for -c to consider regexp meta chars.

sergeyklay commented 5 years ago

I would like to ask you to do this for the reason that you are a much more experienced GNU global user and know more precisely how to reproduce the error and possible workarounds.

nverno commented 4 years ago

+1 bump, just stumbled across this issue with "$N" variables in awk-mode as well. Simple fix is just to (modify-syntax-entry ?$ "'" awk-mode-syntax-table) or provide a custom ggtags-bounds-of-tag-function. $ probably shouldn't be a symbol in most languages, but it's common enough as a prefix that it might be worth handling. I'll try to file a bug in global, unless someone already has