2

Since I use Emacs 24, I always get error when I try to find where a symbol occurs with semantic-symref-symbol. The details are:

  1. I push some key to call semantic-symref-symbol when the cursor is on some symbol of my source file, then I get a list that describes where the symbol occurs in *Symref buffer.
  2. On a entry of the list, I push SPACE or RETURN key, it jump to the right place, but at the same time, Emacs popup *Backtrace* buffer in other window. Its content is as below:

    Debugger entered--Lisp error: (void-variable last-command-char)
      semantic-symref-rb-goto-match(#<overlay from 97 to 126 in *Symref stateStack>)
      push-button(97)
      call-interactively(push-button nil nil)
    

    Then I follow the semantic-symref-rb-goto-match function, which is defined in semantic-symref-list.el. The elisp function is defined as below:

    (defun semantic-symref-rb-goto-match (&optional button)
      "Go to the file specified in the symref results buffer.
    BUTTON is the button that was clicked."
      (interactive)
      (let* ((tag (button-get button 'tag))
         (line (button-get button 'line))
         (buff (semantic-tag-buffer tag))
         (win (selected-window))
         )
        (switch-to-buffer-other-window buff)
        (goto-line line)
        (pulse-momentary-highlight-one-line (point))
        (when (eq last-command-char ? ) (select-window win))
        )
      )
    

    I found the last-command-char in the function, but I don't understand why Emacs complain that (void-variable last-command-char). It should be the key code of space or return.

I want to know the reason and to fix this issue.

tshepang
  • 12,111
  • 21
  • 91
  • 136
Jolly Wing
  • 31
  • 4
  • I'm not getting a bug. Please provide a minimal file for which the bug occurs. – abo-abo Aug 20 '13 at 13:45
  • @abo-abo Each time I use `semantic-symref-symbol`, I got this bug. I do it to a minimal c source file with content of `void main(){}`, I push `C-c r` on `main` to find where `main` occurs, I get a list with only one entry. Then I push SPACE or RETURN key on the only entry of list, the cursor will jump onto the right position, but I'll also get the `*backtrace*` buffer which complains "void-variable last-command-char". According to the answer given by *Drew*, the reason is that the variable `last-command-char` is removed since Emacs 24.3. However, the cedet I use is also built-in in Emacs. – Jolly Wing Aug 23 '13 at 13:07

2 Answers2

5

Replace the reference to a last-command-char with the last-command-event. When it existed, last-command-char was an alias for last-command-event.

TLama
  • 75,147
  • 17
  • 214
  • 392
Simul
  • 51
  • 1
  • 2
0

last-command-char was removed from Emacs 24.3. It is still defined in Emacs 24.2. It is mentioned in the 24.3 NEWS:

** Some obsolete functions, variables, and faces have been removed:
*** `last-input-char', `last-command-char', `unread-command-char'

In Emacs 24.2, C-h v last-command-char says that it has been obsolete since at least Emacs 19.34.

Please report a bug to the owner of the code.

Drew
  • 29,895
  • 7
  • 74
  • 104
  • Yes, I am using Emacs 24.3, the cedet is built-in with emacs. Should I report it as a bug to GNU Emacs? I'll try the newest version of standalone cedet. Thank you, Drew. – Jolly Wing Aug 23 '13 at 12:30
  • If the calling code is from GNU Emacs, then yes, `M-x report-emacs-bug`. Otherwise, report it to the author of that code. – Drew Aug 23 '13 at 14:29