"void-variable last-command-char" error when I use semantic to locate symbol

1.6k views Asked by At

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.

2

There are 2 answers

2
Drew On

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.

0
Simul On

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.