Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
customizing emacs with perl: Text::Autoformat
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Joe Brenner  
View profile  
 More options Aug 14 2009, 8:43 pm
From: Joe Brenner <d...@kzsu.stanford.edu>
Date: Fri, 14 Aug 2009 17:43:06 -0700
Local: Fri, Aug 14 2009 8:43 pm
Subject: customizing emacs with perl: Text::Autoformat

Here's a nice simple trick.  If you don't like the way emacs is
formatting your text, one solution is to use an external program
to do it via "shell-command-on-region":

I was just writing a line of text with some embedded right angle
brackets in it: '>>'. The line was getting long but there's a bug with
M-q ("fill-paragraph") in emacs (at least in MH-Letter-mode).  It takes
a line like this:

  Right, that's probably a harder one: '>>' looks like it's part of a heredoc.

And wraps it like:

  Right, that's probably a harder one: '>>' looks like it's part of a
                                        >>heredoc.

Apparently it gets confused and thinks the angles indicate text quoted
from a previous reply...  The way I want this to wrap is like so:

  Right, that's probably a harder one: '>>' looks like it's part of
  a heredoc.

And that is exactly what this does (but you do need to select the text
first, before doing a "M-oM-f"):

  (defun doom-run-text-autoformat-on-region (start end)
    "Format the region using Text::Autoformat."
    (interactive "r")
    (let ( (command
            (format
               "perl -MText::Autoformat -e'autoformat {right=> %d, all=>1}'"
               fill-column)) )
      (shell-command-on-region start end command nil t "*error*")
      ))
  (global-set-key "\M-o\M-f" 'doom-run-text-autoformat-on-region)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »