1

I'm new with Emacs and come from Joe.

There I started editing mail from the command line by

joe -rmargin 60

because I don't want to generally set the right margin to 60.

I can't find a similar command-line option in Emacs.

Is there one somewhere?

Drew
  • 75,699
  • 9
  • 109
  • 225
tmp1
  • 11
  • 2
  • 1
    What do you mean by "line wrap"? Are you talking about having the editor break up lines at a given column, or are you talking about how it displays text you're editing? –  Jul 18 '19 at 16:05
  • Hi, I want to have the file saved after editing broken up lines at column 60. I'm not interested in how the file is displayed. – tmp1 Jul 20 '19 at 08:00
  • You could try setting the variable per-buffer for your mode for editing emails, or for `text-mode`, so that filling is set only for editing text rather than code. If you want to have that specific setting for a given instance of Emacs, you might want to look into the `--eval` option. –  Jul 22 '19 at 15:02

1 Answers1

1

While emacs doesn't have this feature, you can evaluate elisp on startup:

emacs --eval "(setq fill-column 60)"

This will set the value for the initial buffer, however you may want to apply this to a mode instead, read on....


If you only want this for a spesific mode, you an do:

emacs --eval "(add-hook 'mail-mode-hook (lambda () (setq fill-column 60)))"

With emacs 27 you can draw this on startup too:

emacs --eval "(add-hook 'mail-mode-hook (lambda () (setq fill-column 60) (display-fill-column-indicator-mode)))"

Although in this case you would typically do this in your init file, not using the command line, eg:

(add-hook 'mail-mode-hook
          (lambda ()
            (setq fill-column 60)
            (display-fill-column-indicator-mode)))
ideasman42
  • 8,375
  • 1
  • 28
  • 105
  • My Emacs is 26.1 emacs --eval "(setq fill-column 60)" does not what is promised - I suppose I have to load some "elisp" feature? But in the first place I'm content to learn that there is no such option and I have to look for workarounds. – tmp1 Jul 24 '19 at 11:28
  • 1
    `fill-column` is automatically buffer-local, so the suggested approach is flawed. I think the OP also wants `auto-fill-mode`? Better to do this with a mode hook, I think (possibly `mail-mode-hook`). – phils Dec 20 '19 at 09:28
  • Updated answer, to include a `mail-mode-hook` – ideasman42 Dec 20 '19 at 12:19
  • Heh. I was more thinking that `--eval` was not needed, and they could just do this in their init file. – phils Dec 20 '19 at 12:53