bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#6078: 23.1.90; switch-to-buffer does not redisplay until an event oc


From: Dimitri Fontaine
Subject: bug#6078: 23.1.90; switch-to-buffer does not redisplay until an event occurs
Date: Fri, 30 Apr 2010 20:35:15 +0200

The following code, an attempt to have a visual window switching
facility, is failing to provide the visual clue it's meant to give. That
seems to be because switch-to-buffer won't redisplay until some event
occurred, and neither using sit-for nor redisplay helps.

Here's the code:

(defun dim:switch-window-display-number (win num)
  "prepare a temp buffer to diplay in the window while choosing"
  (let ((buf (get-buffer-create
              (concat " *" (number-to-string num) "*"))))
    (with-current-buffer buf
      (insert (concat "\n\n    " (number-to-string num)))
      (text-scale-adjust 12))

    ;; when it works we'll choose one or the other
    (set-window-buffer win buf)
    (select-window win)
    (switch-to-buffer buf 'non-record)
    buf))

(defun dim:switch-window ()
  "Display an overlay in each window showing a unique key, then
ask user for the window where move to"
  (interactive)
  (let ((config (current-window-configuration))
        (num 1)
        (redisplay-dont-pause t)
        key
        buffers)
    
    (dolist (win (window-list))
      (setq buffers (cons (dim:switch-window-display-number win num) buffers))
      (setq num (1+ num)))

    ;(redisplay 1)
    (sit-for 0)
    (while (not key)
      (let ((input (event-basic-type (read-event "Move to window: " nil 5))))
        (when (and (not (symbolp input)) (<= 49 input) (>= 57 input))
          (setq key (- input 48)))))
    (message "%S" key)

    (dolist (buf buffers)
      (kill-buffer buf))

    (set-window-configuration config)

    (setq num 1)
    (dolist (win (window-list))
      (when (eq num key)
        (select-window win))
      (setq num (1+ num)))))


In GNU Emacs 23.1.90.1 (x86_64-apple-darwin10.2.0, NS apple-appkit-1038.25)
 of 2010-03-25 on proton.local
Windowing system distributor `Apple', version 10.3.1038
configured using `configure  '--without-dbus' '--with-ns' 'CFLAGS=-pipe -O2 
-march=nocona''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  savehist-mode: t
  desktop-save-mode: t
  nxhtml-global-minor-mode: t
  iswitchb-mode: t
  diff-auto-refine-mode: t
  global-hl-line-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-fill-mode: 1

Recent input:
a r y : : SPC t h e SPC o n y <backspace> l y SPC c 
h a n g e SPC i s SPC h o w SPC t o SPC d o SPC i t 
, SPC n o t SPC w h a t SPC e r <backspace> <backspace> 
w e C-a M-f M-f M-f SPC p r o p o s e d C-e SPC c u 
r r e n <M-backspace> d o . C-x C-s C-a C-c C-c q p 
<return> M-` M-` C-n n M-` c o l u m n s , SPC s o 
r r y <return> a h SPC o <backspace> y s <backspace> 
e s <return> C-c C-b <return> w g a t <backspace> <backspace> 
<backspace> h a t s <backspace> ' s SPC t h a t SPC 
l i n g SPC h a s M-b M-b M-b <M-backspace> <backspace> 
SPC h a s SPC C-e <M-backspace> <backspace> <backspace> 
k SPC t SPC <backspace> o SPC d o SPC h e r e ? SPC 
: ) <return> M-` M-` i <backspace> l k <backspace> 
i k e SPC q <backspace> a <M-backspace> <M-backspace> 
a SPC 1 0 SPC h o u r s SPC t <backspace> p l a n e 
SPC t r p <backspace> i p SPC f o r SPC t h a t ? SPC 
n o SPC t h a n s <backspace> k s SPC : ) <return> 
M-` SPC n SPC n M-1 M-` <S-right> <S-up> C-h C-g C-x 
h M-w M-x e m <tab> a s <tab> c s <backspace> <backspace> 
<backspace> c s <tab> - r e <tab> <M-backspace> <M-backspace> 
r e p o <tab> r <tab> e m <backspace> <backspace> b 
<tab> <return>

Recent messages:
Fetching headers for nnimap+hm.local:PostgreSQL.hackers...done
Generating summary...done
Auto-saving...
20:23 You were mentioned by yonkeltron in #emacs [2 times]
20:24 You were mentioned by yonkeltron in #emacs [2 times]
Mark set [2 times]
Saved text until "+ num)))))

(provide 'dim-switch-window)"
Making completion list... [2 times]

Load-path shadows:
/Users/dim/.emacs.d/elpa/emms-3.0/tq hides ~/.emacs.d/emms/lisp/tq
/Users/dim/.emacs.d/elpa/emms-3.0/ogg-comment hides 
~/.emacs.d/emms/lisp/ogg-comment
/Users/dim/.emacs.d/elpa/emms-3.0/later-do hides ~/.emacs.d/emms/lisp/later-do
/Users/dim/.emacs.d/elpa/emms-3.0/jack hides ~/.emacs.d/emms/lisp/jack
/Users/dim/.emacs.d/elpa/emms-3.0/emms hides ~/.emacs.d/emms/lisp/emms
/Users/dim/.emacs.d/elpa/emms-3.0/emms-volume hides 
~/.emacs.d/emms/lisp/emms-volume
/Users/dim/.emacs.d/elpa/emms-3.0/emms-volume-amixer hides 
~/.emacs.d/emms/lisp/emms-volume-amixer
/Users/dim/.emacs.d/elpa/emms-3.0/emms-url hides ~/.emacs.d/emms/lisp/emms-url
/Users/dim/.emacs.d/elpa/emms-3.0/emms-tag-editor hides 
~/.emacs.d/emms/lisp/emms-tag-editor
/Users/dim/.emacs.d/elpa/emms-3.0/emms-streams hides 
~/.emacs.d/emms/lisp/emms-streams
/Users/dim/.emacs.d/elpa/emms-3.0/emms-stream-info hides 
~/.emacs.d/emms/lisp/emms-stream-info
/Users/dim/.emacs.d/elpa/emms-3.0/emms-source-playlist hides 
~/.emacs.d/emms/lisp/emms-source-playlist
/Users/dim/.emacs.d/elpa/emms-3.0/emms-source-file hides 
~/.emacs.d/emms/lisp/emms-source-file
/Users/dim/.emacs.d/elpa/emms-3.0/emms-setup hides 
~/.emacs.d/emms/lisp/emms-setup
/Users/dim/.emacs.d/elpa/emms-3.0/emms-score hides 
~/.emacs.d/emms/lisp/emms-score
/Users/dim/.emacs.d/elpa/emms-3.0/emms-playlist-sort hides 
~/.emacs.d/emms/lisp/emms-playlist-sort
/Users/dim/.emacs.d/elpa/emms-3.0/emms-playlist-mode hides 
~/.emacs.d/emms/lisp/emms-playlist-mode
/Users/dim/.emacs.d/elpa/emms-3.0/emms-playing-time hides 
~/.emacs.d/emms/lisp/emms-playing-time
/Users/dim/.emacs.d/elpa/emms-3.0/emms-player-xine hides 
~/.emacs.d/emms/lisp/emms-player-xine
/Users/dim/.emacs.d/elpa/emms-3.0/emms-player-simple hides 
~/.emacs.d/emms/lisp/emms-player-simple
/Users/dim/.emacs.d/elpa/emms-3.0/emms-player-mplayer hides 
~/.emacs.d/emms/lisp/emms-player-mplayer
/Users/dim/.emacs.d/elpa/emms-3.0/emms-player-mpg321-remote hides 
~/.emacs.d/emms/lisp/emms-player-mpg321-remote
/Users/dim/.emacs.d/elpa/emms-3.0/emms-player-mpd hides 
~/.emacs.d/emms/lisp/emms-player-mpd
/Users/dim/.emacs.d/elpa/emms-3.0/emms-mode-line hides 
~/.emacs.d/emms/lisp/emms-mode-line
/Users/dim/.emacs.d/elpa/emms-3.0/emms-mode-line-icon hides 
~/.emacs.d/emms/lisp/emms-mode-line-icon
/Users/dim/.emacs.d/elpa/emms-3.0/emms-metaplaylist-mode hides 
~/.emacs.d/emms/lisp/emms-metaplaylist-mode
/Users/dim/.emacs.d/elpa/emms-3.0/emms-mark hides ~/.emacs.d/emms/lisp/emms-mark
/Users/dim/.emacs.d/elpa/emms-3.0/emms-lyrics hides 
~/.emacs.d/emms/lisp/emms-lyrics
/Users/dim/.emacs.d/elpa/emms-3.0/emms-lastfm hides 
~/.emacs.d/emms/lisp/emms-lastfm
/Users/dim/.emacs.d/elpa/emms-3.0/emms-last-played hides 
~/.emacs.d/emms/lisp/emms-last-played
/Users/dim/.emacs.d/elpa/emms-3.0/emms-info hides ~/.emacs.d/emms/lisp/emms-info
/Users/dim/.emacs.d/elpa/emms-3.0/emms-info-ogginfo hides 
~/.emacs.d/emms/lisp/emms-info-ogginfo
/Users/dim/.emacs.d/elpa/emms-3.0/emms-info-ogg hides 
~/.emacs.d/emms/lisp/emms-info-ogg
/Users/dim/.emacs.d/elpa/emms-3.0/emms-info-mp3info hides 
~/.emacs.d/emms/lisp/emms-info-mp3info
/Users/dim/.emacs.d/elpa/emms-3.0/emms-info-libtag hides 
~/.emacs.d/emms/lisp/emms-info-libtag
/Users/dim/.emacs.d/elpa/emms-3.0/emms-i18n hides ~/.emacs.d/emms/lisp/emms-i18n
/Users/dim/.emacs.d/elpa/emms-3.0/emms-history hides 
~/.emacs.d/emms/lisp/emms-history
/Users/dim/.emacs.d/elpa/emms-3.0/emms-compat hides 
~/.emacs.d/emms/lisp/emms-compat
/Users/dim/.emacs.d/elpa/emms-3.0/emms-cache hides 
~/.emacs.d/emms/lisp/emms-cache
/Users/dim/.emacs.d/elpa/emms-3.0/emms-browser hides 
~/.emacs.d/emms/lisp/emms-browser
/Users/dim/.emacs.d/elpa/emms-3.0/emms-bookmarks hides 
~/.emacs.d/emms/lisp/emms-bookmarks
/Users/dim/.emacs.d/nxhtml/util/htmlfontify hides 
/Applications/Emacs.app/Contents/Resources/lisp/htmlfontify
/Users/dim/.emacs.d/elpa/emms-3.0/tq hides 
/Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/tq
/Users/dim/.emacs.d/nxhtml/util/chart hides 
/Applications/Emacs.app/Contents/Resources/lisp/emacs-lisp/chart

Features:
(shadow emacsbug flow-fill multi-isearch bbdb-hooks w3m-form w3m-symbol
w3m doc-view image-mode w3m-hist w3m-fb w3m-ems w3m-ccl ccl w3m-favicon
w3m-image w3m-proc w3m-util dim-switch-window bbdb-gui gnus-cite smiley
ansi-color gnus-agent gnus-srvr nnvirtual gnus-async gnus-bcklg
gnus-score score-mode sort gnus-ml gnus-msg tar-mode face-remap ffap
gnus-topic nndoc gnus-cache nnfolder utf-7 utf7 auth-source nnimap imap
nndraft nnmh bbdb-gnus bbdb-snarf mail-extr bbdb-com warnings nnnil nntp
bbdb-autoloads bbdb timezone gnus-art mm-uu mml2015 epg-config mm-view
smime dig gnus-sum nnoo gnus-group gnus-undo nnmail mail-source
format-spec dim-gnus-imap-count gnus-start gnus-spec gnus-int gnus-range
gnus-win gnus gnus-ems flyspell ispell hideshow mlinks rx nxml-uchnm
rng-nxml rng-xsd xsd-regexp rng-cmpct sgml-mode nxhtml-mumamo mumamo-fun
mumamo nxhtml-mode popcmp url-expand url-util url-methods url-parse
url-vars rngalt rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match
rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap
nxml-util nxml-glyph nxml-enc xmltok loadhist make-mode doc-mode sql
cc-mode cc-fonts cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs python-21 python muse-colors org-wl org-w3m org-vm org-rmail
org-mhe org-mew org-irc org-jsinfo org-infojs org-html org-exp
org-exp-blocks org-agenda org-info org-gnus org-bibtex org-bbdb bitlbee
conf-mode newcomment jka-compr savehist desktop dim-tels-pro dim-modes
dim-org org-clock org-remember org-datetree org byte-opt bytecomp
byte-compile org-footnote org-src org-list org-faces org-compat org-macs
noutline outline remember org-install dim-ack browse-kill-ring
tramp-multi-sshx dictionary link connection emms-cache emms-info-ogginfo
emms-info-mp3info emms-info later-do emms-playlist-mode
emms-player-mplayer emms-player-simple emms-source-playlist
emms-source-file emms-setup emms emms-compat dim-pgsql linum w3m-load
nxhtml-autoload majmodpri nxhtml-menu nxhtml-autostart rst compile
asciidoc apropos dim-keys dim-previous-message dim-mailrc message
ecomplete rfc822 mml mml-sec password-cache mm-decode mm-bodies
mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums
mailabbrev nnheader gnus-util netrc mm-util mail-prsvr gmm-utils
mailheader canlock sha1 hex-util hashcash mail-utils dim-input-method
quail help-mode view dim-google browse-url hippie-exp comint iswitchb
dired-details dired-x dired-aux dired winner buffer-move windmove
dim-escreen escreen dim-splits dim-rcirc dim-rcirc-log growl
rcirc-late-fix rcirc-color advice help-fns advice-preload rcirc-groups
rcirc time-date dim-projects dim-projects-home projects ibuf-ext
dim-muse dim-muse-hack muse-context muse-journal muse-book muse-latex
muse-html muse-xml-common cus-edit cus-start cus-load muse-publish
muse-project muse-protocols muse-regexps muse muse-nested-tags muse-mode
dim-init-macosx dim-offlineimap magit diff-mode log-edit easy-mmode
pcvs-util add-log parse-time cssh derived term disp-table ehelp electric
ring ibuffer pcmpl-unix pcomplete woman man assoc
color-theme-emacs23-default color-theme edmacro kmacro wid-edit cl cl-19
sendmail regexp-opt dim-visual-common hl-line dim-ports dim-lib
dictionary-autoloads emms-autoloads full-ack-autoloads gist-autoloads
htmlize-autoloads lisppaste-autoloads magit-autoloads muse-autoloads
info xml-rpc-autoloads package reporter tooltip ediff-hook vc-hooks
lisp-float-type mwheel ns-win easymenu tool-bar dnd fontset image fringe
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mldrag mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev loaddefs button minibuffer faces cus-face files text-properties
overlay md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process ns multi-tty
emacs)

-- 
Dimitri Fontaine






reply via email to

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