emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Wrong local keymap after setting major mode in a timer


From: Lennart Borgman
Subject: Wrong local keymap after setting major mode in a timer
Date: Tue, 4 Aug 2009 11:37:30 +0200

Sometimes the (current-local-map) seems to be wrong after setting
major mode in a timer in MuMaMo:

(defun mumamo-idle-set-major-mode (buffer window)
  "Set major mode from mumamo chunk when Emacs is idle.
Do this only if current buffer is BUFFER and then do it in window
WINDOW.

See the variable `mumamo-set-major-mode-delay' for an
explanation."
  (save-match-data ;; runs in idle timer
    (mumamo-msgfntfy "mumamo-idle-set-major-mode b=%s, window=%s" buffer window)
    (with-selected-window window
      ;; According to Stefan Monnier we need to set the buffer too.
      (with-current-buffer (window-buffer)
        (when (eq buffer (current-buffer))
          (mumamo-condition-case err
              ;;(let* ((ovl (mumamo-get-chunk-at (point)))
              (let* ((ovl (mumamo-find-chunks (point)
"mumamo-idle-set-major-mode"))
                     (major (mumamo-chunk-major-mode ovl))
                     (modified (buffer-modified-p)))
                (unless (eq major major-mode)
                  ;;(message "mumamo-set-major at A")
                  (mumamo-set-major major)

I have just seen this happen. The major mode is set to text-mode, but
the keymap is still php-mode map. php-mode is derived from c-mode (if
that matter).

I think someone saw a problem with setting major mode/keymap in a
timer some months ago, but I do not remember more.

Anyone knows what might be going on here? (This is with the latest CVS Emacs.)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]