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?

  • 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? – user12563 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 8: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. – user12563 Jul 22 '19 at 15:02

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)))"
| improve this answer | |
  • 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 9: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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.