emacs-devel
[Top][All Lists]
Advanced

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

Re: mykie.el


From: Yuta Yamada
Subject: Re: mykie.el
Date: Sun, 12 Jan 2014 17:51:41 -0500 (EST)

> > There is a problem.
> > Mew.el that is Emacs mailer check function name whether the name
> > contain self-insert-command.(http://www.mew.org/en/)
> > (I don't know how many program does check global map's function-name.)
> > If we set keybind to self-insert-command like [a-z],
> > then Mew occur an error.

> I don't understand.

Sorry my information lacked details.

Mew.el can change folder by pushing "g" key at mew-summary-mode.
(Mew binds mew-summary-goto-folder function to the "g" key)
To make sure that problem, I set following configuration:

(define-key global-map
  "a" (lambda () (interactive)
        (call-interactively 'self-insert-command)))

(defmacro mykie:combined-command (&rest args)
  `(lambda ()
     (interactive)
     (mykie:core (quote ,args))))

(define-key global-map
  "b" (mykie:combined-command
       :default self-insert-command
       :C-u     (message "C-u + b")))

And then I typed "g" at mew-summary-mode after I boot mew.
And then when I typed a or b, I saw following error on minibuffer.

-- error message
mew-input-folder-self-insert: Wrong type argument: symbolp, #[nil "ÀÁ!‡" 
[call-interactively self-insert-command] 2 nil nil]
--

I extracted partial code from mew-minibuf.el, you can see full code
here: https://github.com/kazu-yamamoto/Mew/blob/master/mew-minibuf.el

--- from mew-minibuf.el ---
(defun mew-input-folder-self-insert ()
  "This function normally inserts its bound key to minibuffer.
When in folder search mode, this function searches a candidate
folder and displays it in addition to its bound key."
  (interactive)
  (let ((key (this-command-keys))
        last-str gfunc)
    (cond
     ((stringp key)
      (setq last-str key)
      (setq gfunc (lookup-key (current-global-map) key)))
     ((vectorp key)
      (setq gfunc (lookup-key (current-global-map) key))
      (unless gfunc
        (setq key (lookup-key function-key-map key))
        (cond
         ((vectorp key) ;; normal Emacs
         (setq gfunc (lookup-key (current-global-map) key)))
         ((stringp key) ;; Meadow
         (setq last-str key)
         (setq gfunc (lookup-key (current-global-map) key)))))))
    (if mew-input-folder-search-direction
        (cond
         ((or (equal key "\177") (equal key [127])
         (equal key 'delete) (equal key 'backspace))
         (if (null mew-input-folder-search-key)
         (mew-input-folder-display "not allowed")
         (setq mew-input-folder-search-key
                 (substring mew-input-folder-search-key 0 -1))
         (when (string= mew-input-folder-search-key "")
         (setq mew-input-folder-search-key nil)
         (setq mew-input-folder-search-match nil)
         (with-current-buffer mew-input-folder-search-buf
                (cond
                 ((eq mew-input-folder-search-direction 'forward)
                 (goto-char (point-min)))
                 ((eq mew-input-folder-search-direction 'backward)
                 (goto-char (point-max))))))
         (mew-input-folder-display)))
         ((not (string-match "self-insert-command" (symbol-name gfunc)))
         (mew-input-folder-display "not allowed"))
         ((eq mew-input-folder-search-direction 'forward)
         (setq mew-input-folder-search-key
                (concat mew-input-folder-search-key last-str))
         (mew-input-folder-search-forward-1))
         ((eq mew-input-folder-search-direction 'backward)
         (setq mew-input-folder-search-key
                (concat mew-input-folder-search-key last-str))
         (mew-input-folder-search-backward-1)))
      (cond
       ((null gfunc)
        ())
       ((string-match "self-insert-command" (symbol-name gfunc))
        (insert last-command-event))
       ((and (fboundp gfunc) (commandp gfunc))
        (call-interactively gfunc))))))
--- END ----

I think below part seems problem codes.

---
  ;; gfunc is current global-map's function
  ((not (string-match "self-insert-command" (symbol-name gfunc)))
   (mew-input-folder-display "not allowed"))
---

Yuta

reply via email to

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