jed-users mailing list

[2011 Date Index] [2011 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [Jed-users-l] Turning off auto-wrap


This works to stop wrap in a *.txt file, but only if I call toggle_wrapmode
*after* opening the file.
I want to turn off wrapmode as a default.

If I try to set "toggle_wrapmode;" as a default in .jedrc, it has no effect
on wrap within a *.txt file that I subsequently open.

Is there a way to modify this so I can turn off wrapmode in .jedrc as a
default for all files that I subsequently open (without having to call
toggle_wrapmode after opening the file)?

-Doug

On Sat, Jun 25, 2011 at 8:02 AM, Henry Harpending <harpend@xxxxxxxxx> wrote:

> Here is what I have in my .jedrc for this purpose, almost certainly
> liberated from someone else's code in the distant past:
>
>
>    define toggle_wrapmode ()
>    {
>        variable mode, modestr;
>        (modestr, mode) = what_mode();
>        if (mode & 1){
>               % test wrap bit
>               mode = mode & ~(1);  % wrap bit on so mask it off
>               (modestr,)=strreplace(modestr,"Wrap","",1);
>        }
>        else {
>               mode = mode | 1;  % wrap bit off so set it.
>               modestr=strcat(modestr," Wrap");
>        }
>        set_mode (modestr, mode);
>    }
>
> and assigned to keys:
>
>      setkey("toggle_wrapmode", "^XM");
>      setkey("toggle_wrapmode", "^Xm");
>      setkey("toggle_wrapmode", "^X^M");
>
>
> (Sorry about the top posting: some lists have lurking top posting police
> but I can't remember the customs on this list)
>
> Henry Harpending
>
>
>
> On 06/24/2011 10:56 PM, Parke Bostrom wrote:
> > On Fri, Jun 24, 2011 at 02:34:59PM -0700, Doug Kramer wrote:
> >
> >> (Delayed followup)
> >>
> >> I don't quite follow set_buffer_hook. (Are hooks related to modes?)
> > Hooks are described in the following file:
> >
> >> On Thu, May 5, 2011 at 4:14 PM, Parke Bostrom<parke.bostrom@xxxxxxxxx
> >wrote:
> >>> > From (on Ubuntu) /usr/share/jed/doc/txt/hooks.txt:
> > Hooks are event specific callback functions.
> >
> > I suspect that "set_buffer_hook" would install a buffer specific hook,
> > rather than a mode specific hook.  (Of course, it could be the mode
> > that sets the buffer specific hook.)
> >
> >> How do I set WRAP = 1000; for Text mode, please?  (Or for all modes, if
> >> that's easier)
> > I'm not sure.  It might be as simple as putting WRAP = 1000; in .jedrc
> > (outside of any function).
> >
> >> I found some guidance here, but not enough:
> >> http://www.fi.infn.it/info/jed/jed_19.html
> > To edit a function from that page:
> >
> > public define text_mode_hook ()
> >     {
> >        variable mode, modestr;
> >        (modestr, mode) = whatmode ();
> >        mode = mode&  ~(1);  % unset wrap bit
> >        setmode (modestr, mode);
> >     }
> >
> > (I believe) the above function would give you a text_mode_hook function
> > that would run (on the buffer) every time a buffer enters text-mode.
> > The hook unsets the mode's wrap bit (hopefully disabling wrapping).
> >
> > I believe jed actually has 2 layers of modes:  modestr is a string that
> > names a mode.  modestr modes are more flexible and customizable.  The
> > "mode" variable, on the other hand, chooses between a very small set of
> > fundamental/primative modes that are much less flexible.  Knowing that
> > these two layers exist might(?) help you avoid confusion.
> >
> > -Parke
> > _______________________________________________
> > Jed-users-l mailing list
> > Jed-users-l@xxxxxxxx
> > http://mailman.jtan.com/mailman/listinfo/jed-users-l
> _______________________________________________
> Jed-users-l mailing list
> Jed-users-l@xxxxxxxx
> http://mailman.jtan.com/mailman/listinfo/jed-users-l
>
_______________________________________________
Jed-users-l mailing list
Jed-users-l@xxxxxxxx
http://mailman.jtan.com/mailman/listinfo/jed-users-l


[2011 date index] [2011 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]