Function: modifier-bar-button

modifier-bar-button is a byte-compiled function defined in tool-bar.el.gz.

Signature

(modifier-bar-button INIT-MODIFIER-LIST)

Documentation

Decode the key sequence associated with a modifier bar button.

INIT-MODIFIER-LIST is a list of one symbol describing the button being pressed.

Bind modifier-bar-modifier-list to INIT-MODIFIER-LIST. Read events, adding each subsequent modifier bar event's associated modifier to that list while updating the tool bar to disable buttons that were pressed. Return any other event read with all modifier keys read applied.

Temporarily disable text conversion and display the on screen keyboard while doing so.

Source Code

;; Defined in /usr/src/emacs/lisp/tool-bar.el.gz
(defun modifier-bar-button (init-modifier-list)
  "Decode the key sequence associated with a modifier bar button.
INIT-MODIFIER-LIST is a list of one symbol describing the button
being pressed.

Bind `modifier-bar-modifier-list' to INIT-MODIFIER-LIST.  Read
events, adding each subsequent modifier bar event's associated
modifier to that list while updating the tool bar to disable
buttons that were pressed.  Return any other event read with all
modifier keys read applied.

Temporarily disable text conversion and display the on screen
keyboard while doing so."
  ;; Save the previously used text conversion style.
  (let ((old-text-conversion-style text-conversion-style)
        ;; Clear the list of modifiers currently pressed.
        (modifier-bar-modifier-list init-modifier-list))
    ;; Disable text conversion.
    (when (fboundp 'set-text-conversion-style)
      (set-text-conversion-style nil))
    (unwind-protect
        (progn
          ;; Display the on screen keyboard.
          (frame-toggle-on-screen-keyboard nil nil)
          ;; Update the tool bar to disable this modifier key.
          (force-mode-line-update)
          (let* ((modifiers init-modifier-list) event1
                 (overriding-text-conversion-style nil)
                 (event (read-event)))
            ;; Combine any more modifier key presses.
            (while (eq event 'tool-bar)
              (setq event1 (event-basic-type (read-event)))
              ;; Reject unknown tool bar events.
              (unless (memq event1 '(alt super hyper shift control meta))
                (user-error "Unknown tool-bar event %s" event1))
              ;; If `event' is the name of a modifier key, apply that
              ;; modifier key as well.
              (unless (memq event1 modifiers)
                (push event1 modifiers)
                ;; This list is used to check which tool bar buttons
                ;; need to be enabled.
                (push event1 modifier-bar-modifier-list))
              ;; Update the tool bar to disable the modifier button
              ;; that was read.
              (force-mode-line-update)
              (redisplay)
              ;; Read another event.
              (setq event (read-event)))
            ;; EVENT is a keyboard event to which the specified list of
            ;; modifier keys should be applied.
            (vector (tool-bar-apply-modifiers event modifiers))))
      ;; Re-enable text conversion if necessary.
      (unless (or (not (fboundp 'set-text-conversion-style))
                  (eq old-text-conversion-style text-conversion-style))
        (set-text-conversion-style old-text-conversion-style t))
      ;; Re-enable all modifier bar buttons which may have been
      ;; disabled.
      (force-mode-line-update))))