Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!ginosko!usc!apple!amdahl!daveemme From: daveemme@uts.amdahl.com (Dave Emme) Newsgroups: comp.emacs Subject: Re: Question on truncate-lines Message-ID: <1a0l02YD5d0C01@amdahl.uts.amdahl.com> Date: 5 Oct 89 16:30:32 GMT References: <-285219997@hpcupt1.HP.COM> Reply-To: daveemme@amdahl.uts.amdahl.com (Dave Emme) Organization: Amdahl Corporation, Sunnyvale CA Lines: 36 In article <-285219997@hpcupt1.HP.COM> markd@hpcupt1.HP.COM (Mark Diekhans) writes: >I would like to have a function to toggle the value of the truncate-lines >variable. Unfortunatly doiung a setq or set-variable within a function >does not cause the window to be redrawn the was doing a M-x set-variable >command. I am forced to use the following function, which redraws the >display after toggling the variable. I don't want to wait for the entire >screen to be redrawn. How do I force just the current window to be redrawn? > > (defun toggle-truncate-lines () > "Toggle the value of truncate-lines" > (interactive) > (setq truncate-lines (not truncate-lines)) > (redraw-display)) > >markd@hpsplrf.hp.com or hplabs!hpda!markd Try this: (defun toggle-truncate-lines() "Toggles the value of the variable truncate-lines for the current buffer." (interactive) (setq truncate-lines (not truncate-lines)) (save-excursion (move-to-window-line 0) (recenter 0)) (message "truncate-lines is now %s" truncate-lines)) -- ------------------------------------------------------------------------------ Dave Emme daveemme@uts.amdahl.com Amdahl Corporation {ames, decwrl, sun, uunet}!amdahl!daveemme 1250 E. Arques Ave. M/S 316 Sunnyvale, CA. 94088-3470 "Whenever you find yourself on the side of the majority, it is time to pause and reflect." -- Mark Twain