tag:blogger.com,1999:blog-3992530807750384868.post6505554049788431497..comments2022-03-28T08:42:20.497+03:00Comments on emacs-fu: changing the cursor color and shape dynamicallyUnknownnoreply@blogger.comBlogger16125tag:blogger.com,1999:blog-3992530807750384868.post-32544489894516327482012-07-02T20:38:29.070+03:002012-07-02T20:38:29.070+03:00What about C-x C-+ ? Per default it is bound to te...What about C-x C-+ ? Per default it is bound to text-scale-adjust which apparently does exactly what you want.Edgar Thiernoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-42634620537246566432012-02-25T15:17:23.143+02:002012-02-25T15:17:23.143+02:00when i use this, follow-mode doesn't work anym...when i use this, follow-mode doesn't work anymore, i can't understand why, any suggestion? <br />(emacs 24)Farmariohttps://www.blogger.com/profile/01822516728392893732noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-42763482839538157842011-11-03T03:04:37.942+02:002011-11-03T03:04:37.942+02:00actually, just tried in Emacs 23.3.1 for Windows a...actually, just tried in Emacs 23.3.1 for Windows and it doesn't work there either. So must be something weird in my setups. Never mind...sinewalkerhttps://www.blogger.com/profile/11435214145820445779noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-87555386879801990482011-11-03T02:34:48.909+02:002011-11-03T02:34:48.909+02:00Hi, I'm trying out Emacs 24 early release (Win...Hi, I'm trying out Emacs 24 early release (Windows build from Google Code - http://code.google.com/p/emacs-for-windows/updates/list ). It's using the hbar cursor shape and it seems I can't get back to block/hollow no matter what I try.<br /><br />I find the X11 style block/hollow to be much easier to see and read than the little bar, so I'd like to get the block back. I even tried this code but it's not having any effect.<br /><br />Has anyone played with this yet? Should I report a bug or is it a feature?sinewalkerhttps://www.blogger.com/profile/11435214145820445779noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-41918172102077677102009-12-13T19:44:22.056+02:002009-12-13T19:44:22.056+02:00@djcb yes, it takes away that slowness / not smoot...@djcb yes, it takes away that slowness / not smooth part in your code. could be a mac os x thing then...no idea.vinhdizzohttps://www.blogger.com/profile/01446145211934423625noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-46552632779062676852009-12-12T14:24:43.174+02:002009-12-12T14:24:43.174+02:00@vinhdizzo: ah, does this make things faster for y...@vinhdizzo: ah, does this make things faster for you? I couldn't see any noticeable difference.djcbhttps://www.blogger.com/profile/15938154009846040711noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-66950285683925458902009-12-12T04:19:26.552+02:002009-12-12T04:19:26.552+02:00@djcb i think all those conditionals is causing th...@djcb i think all those conditionals is causing the slowness in the cursor for me. following your advice to the emacswiki page, i modified the code a little to change cursor-type (don't care about color, i care about type) for anyone that is interested:<br /><br />(defvar hcz-set-cursor-type-type t)<br />(defvar hcz-set-cursor-type-buffer t)<br />(defun hcz-set-cursor-type-according-to-mode ()<br /> "change cursor type according to some minor modes."<br /> ;; set-cursor-color is somewhat costly, so we only call it when needed:<br /> ;; setq cursor-type is somewhat costly, so we only call it when needed:<br /> (let ((type<br /> (if buffer-read-only 'hbar<br /> (if overwrite-mode 'hollow<br /> 'box))))<br /> (unless (and<br /> (string= type hcz-set-cursor-type-type)<br /> (string= (buffer-name) hcz-set-cursor-type-buffer))<br /> ;;(set-cursor-color (setq hcz-set-cursor-color-color color))<br /> (setq cursor-type (setq hcz-set-cursor-type-type type))<br /> (setq hcz-set-cursor-type-buffer (buffer-name)))<br /> )<br /> )<br />(add-hook 'post-command-hook 'hcz-set-cursor-type-according-to-mode)vinhdizzohttps://www.blogger.com/profile/01446145211934423625noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-12694907065530054882009-12-08T08:32:24.334+02:002009-12-08T08:32:24.334+02:00@vinhdizzo: if you see the code on emacswiki (link...@vinhdizzo: if you see the code on emacswiki (linked in the article), the snippet there actually caches the current color (ie., only set it if it has changed). I found that unnecessary, (C-n is smooth here) but maybe it's still needed on MacOS?djcbhttps://www.blogger.com/profile/15938154009846040711noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-79519618705396611842009-12-08T05:29:47.974+02:002009-12-08T05:29:47.974+02:00this is indeed nice -- visualization communication...this is indeed nice -- visualization communication of the editing mode.<br /><br />i'm on mac os x with emacs 23.1 built from source. do u guys have this issue after using djcb's code?<br /><br />hold C-n or down. the cursor doesn't move down slowly (u can't see it go line by line). u see it flashing at one line, then skip MULTIPLE LINES. this is so unappealing to my eyes that i had to remove this feature.<br /><br />can u guys replicate this? thanks.vinhdizzohttps://www.blogger.com/profile/01446145211934423625noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-41570683845811203182009-12-07T20:28:02.367+02:002009-12-07T20:28:02.367+02:00I like it. It's part of my .emacs file now.I like it. It's part of my .emacs file now.Petehttps://www.blogger.com/profile/03172977757828307423noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-91271842152169670942009-12-07T20:18:19.902+02:002009-12-07T20:18:19.902+02:00@Oscar, @lifealgorithms: arghh... my usual last-mi...@Oscar, @lifealgorithms: arghh... my usual last-minute error... indeed 'block should be 'box <br /><br />@Anonymous: it's the 'New Wave' theme.djcbhttps://www.blogger.com/profile/15938154009846040711noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-51721676219282196712009-12-07T17:15:06.172+02:002009-12-07T17:15:06.172+02:00Cool ideas! I think, I'll stick with a red bar...Cool ideas! I think, I'll stick with a red bar in default mode. <br /><br />@oscar: replacing 'block by 'box in the code works for me. I'm using the same version of emacs - maybe they changed the naming.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-73941856072719340082009-12-07T17:05:21.430+02:002009-12-07T17:05:21.430+02:00Hey, nice! Now I change the cursor type depending...Hey, nice! Now I change the cursor type depending if a region is active. If so, I like the bar cursor better than the box one.<br /><br />Here's the code:<br /><br /><i><br />(defun th-activate-mark-init ()<br /> (setq cursor-type 'bar))<br />(add-hook 'activate-mark-hook 'th-activate-mark-init)<br /><br />(defun th-deactivate-mark-init ()<br /> (setq cursor-type 'box))<br />(add-hook 'deactivate-mark-hook 'th-deactivate-mark-init)<br /></i>Tassilohttp://www.tsdh.denoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-3660057965137957702009-12-07T14:08:39.019+02:002009-12-07T14:08:39.019+02:00What window theme is this? It looks very nice and ...What window theme is this? It looks very nice and cleanAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-77264804451262796412009-12-07T11:14:30.482+02:002009-12-07T11:14:30.482+02:00Using Emacs 23.1 on Windows XP and your above code...Using Emacs 23.1 on Windows XP and your above code, my block-cursors are transparent with a colored border (ie, when the block is supposed to be red, it becomes a white block with red borders) - why is that? :(<br /><br />Anyone else experiencing the same issue?Oscarhttps://www.blogger.com/profile/16349261750902063941noreply@blogger.comtag:blogger.com,1999:blog-3992530807750384868.post-795150886648007832009-12-07T06:51:53.738+02:002009-12-07T06:51:53.738+02:00This comment has been removed by the author.vinhdizzohttps://www.blogger.com/profile/01446145211934423625noreply@blogger.com