all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
@ 2021-10-17  5:30 Hongyi Zhao
  2021-10-17  6:23 ` Eli Zaretskii
  2021-10-17 15:30 ` Yuri Khan
  0 siblings, 2 replies; 19+ messages in thread
From: Hongyi Zhao @ 2021-10-17  5:30 UTC (permalink / raw)
  To: help-gnu-emacs

The `fill-paragraph' will fill a paragraph at or after the point. But
I want to `fill-paragraph' on all the paragraphs in the currently
opened LaTeX document. Is there a convenient way to do this?

Regards
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-17  5:30 Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document Hongyi Zhao
@ 2021-10-17  6:23 ` Eli Zaretskii
  2021-10-17  7:23   ` Hongyi Zhao
  2021-10-17 15:30 ` Yuri Khan
  1 sibling, 1 reply; 19+ messages in thread
From: Eli Zaretskii @ 2021-10-17  6:23 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Hongyi Zhao <hongyi.zhao@gmail.com>
> Date: Sun, 17 Oct 2021 13:30:02 +0800
> 
> The `fill-paragraph' will fill a paragraph at or after the point. But
> I want to `fill-paragraph' on all the paragraphs in the currently
> opened LaTeX document. Is there a convenient way to do this?

Did you try to search the documentation?  There's the
fill-individual-paragraphs command which seems to be what you want.



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-17  6:23 ` Eli Zaretskii
@ 2021-10-17  7:23   ` Hongyi Zhao
  2021-10-17 10:25     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 19+ messages in thread
From: Hongyi Zhao @ 2021-10-17  7:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

On Sun, Oct 17, 2021 at 2:23 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Hongyi Zhao <hongyi.zhao@gmail.com>
> > Date: Sun, 17 Oct 2021 13:30:02 +0800
> >
> > The `fill-paragraph' will fill a paragraph at or after the point. But
> > I want to `fill-paragraph' on all the paragraphs in the currently
> > opened LaTeX document. Is there a convenient way to do this?
>
> Did you try to search the documentation?  There's the
> fill-individual-paragraphs command which seems to be what you want.

I only want the real text paragraphs to be filled without disturbing
other LaTeX typesetting commands, say, avoiding running this command
on the following text block:

%%%%%%%%%
\documentclass[twocolumn,showpacs,preprintnumbers,amsmath,amssymb,prb,aps]{revtex4-1}
\usepackage{epsfig}% Include figure files$
\usepackage{epstopdf}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage{textcomp}
\usepackage{array}
\usepackage{caption}
\usepackage{xfrac}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{subfigure}
%%%%%%%%%

But all the fill.*paragraph.* relevant commands can not meet the above
requirement.

HZ



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-17  7:23   ` Hongyi Zhao
@ 2021-10-17 10:25     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-10-17 12:28       ` Hongyi Zhao
  0 siblings, 1 reply; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-17 10:25 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

> I only want the real text paragraphs to be filled without
> disturbing other LaTeX typesetting commands, say, avoiding
> running this command on the following text block
>
> %%%%%%%%%
> \documentclass[twocolumn,showpacs,preprintnumbers,amsmath,amssymb,prb,aps]{revtex4-1}
> \usepackage{epsfig}% Include figure files$
> \usepackage{epstopdf}
> \usepackage{graphicx}% Include figure files
> \usepackage{dcolumn}% Align table columns on decimal point
> \usepackage{bm}% bold math
> \usepackage{textcomp}
> \usepackage{array}
> \usepackage{caption}
> \usepackage{xfrac}
> \usepackage{mathtools}
> \usepackage{amsmath}
> \usepackage{subfigure}
> %%%%%%%%%

Naah ... it is a bad idea to adapt the code to the editing
command, better to adapt the command to the code!

So drop the %%%%%%%%% is step one ...

Step two is to - _think_ ...

Will it be enough to not fill lines that start with \ (REVERSE
SOLIDUS or BACKSLASH)?

And fill everything else?

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-17 10:25     ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-10-17 12:28       ` Hongyi Zhao
  2021-10-17 12:42         ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 19+ messages in thread
From: Hongyi Zhao @ 2021-10-17 12:28 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

On Sun, Oct 17, 2021 at 6:26 PM Emanuel Berg via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> Hongyi Zhao wrote:
>
> > I only want the real text paragraphs to be filled without
> > disturbing other LaTeX typesetting commands, say, avoiding
> > running this command on the following text block
> >
> > %%%%%%%%%
> > \documentclass[twocolumn,showpacs,preprintnumbers,amsmath,amssymb,prb,aps]{revtex4-1}
> > \usepackage{epsfig}% Include figure files$
> > \usepackage{epstopdf}
> > \usepackage{graphicx}% Include figure files
> > \usepackage{dcolumn}% Align table columns on decimal point
> > \usepackage{bm}% bold math
> > \usepackage{textcomp}
> > \usepackage{array}
> > \usepackage{caption}
> > \usepackage{xfrac}
> > \usepackage{mathtools}
> > \usepackage{amsmath}
> > \usepackage{subfigure}
> > %%%%%%%%%
>
> Naah ... it is a bad idea to adapt the code to the editing
> command, better to adapt the command to the code!
>
> So drop the %%%%%%%%% is step one ...
>
> Step two is to - _think_ ...
>
> Will it be enough to not fill lines that start with \ (REVERSE
> SOLIDUS or BACKSLASH)?
>
> And fill everything else?

How to select/mark/narrow-to all the lines that don't start with `\'?

HZ



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-17 12:28       ` Hongyi Zhao
@ 2021-10-17 12:42         ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-17 12:42 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

> How to select/mark/narrow-to all the lines that don't start
> with `\'?

I don't know if Emacs has its own way already to do this, but
in general ...

You could iterate the whole buffer line-by-line, and check
each line if it starts with '\' or not, e.g. with (looking-at
"\\\\"). When you find one "beg", start looking for where it
ends, and when you find that push (beg end) onto a list.

Then loop thru the list and do (fill-region beg end) for each
list pair item ...

PS. That sounds like fun, please post the code here :)

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-17  5:30 Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document Hongyi Zhao
  2021-10-17  6:23 ` Eli Zaretskii
@ 2021-10-17 15:30 ` Yuri Khan
  2021-10-17 15:37   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-10-18  0:22   ` Hongyi Zhao
  1 sibling, 2 replies; 19+ messages in thread
From: Yuri Khan @ 2021-10-17 15:30 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

On Sun, 17 Oct 2021 at 12:30, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:

> The `fill-paragraph' will fill a paragraph at or after the point. But
> I want to `fill-paragraph' on all the paragraphs in the currently
> opened LaTeX document. Is there a convenient way to do this?

Why do you even want that?
When you compile,
LaTeX will lay out your text by typographic rules.
Meanwhile, you’ll have better experience
treating your LaTeX source as source code —
keep it in a VCS
and format using semantic linefeeds[1].

[1]: https://rhodesmill.org/brandon/2012/one-sentence-per-line/



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-17 15:30 ` Yuri Khan
@ 2021-10-17 15:37   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-10-17 15:45     ` Yuri Khan
  2021-10-18  0:22   ` Hongyi Zhao
  1 sibling, 1 reply; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-17 15:37 UTC (permalink / raw)
  To: help-gnu-emacs

Yuri Khan wrote:

> Why do you even want that?

Well, as they saying goes, the question is not why
but "how" ...

> When you compile, LaTeX will lay out your text by
> typographic rules

We are on the edit stage here ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-17 15:37   ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-10-17 15:45     ` Yuri Khan
  2021-10-17 17:22       ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 19+ messages in thread
From: Yuri Khan @ 2021-10-17 15:45 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs

On Sun, 17 Oct 2021 at 22:38, Emanuel Berg via Users list for the GNU
Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> > When you compile, LaTeX will lay out your text by
> > typographic rules
>
> We are on the edit stage here ...

Yeah, and you better focus on the text being composed
rather than on trying to preserve the filling.

Refilling a paragraph introduces a lot of changes in the diff,
and keeping separate sentences on separate lines minimizes the diff.
(See the article linked above for a better explanation.)



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-17 15:45     ` Yuri Khan
@ 2021-10-17 17:22       ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-17 17:22 UTC (permalink / raw)
  To: help-gnu-emacs

Yuri Khan wrote:

> Refilling a paragraph introduces a lot of changes in the
> diff [...]

To the better, is the idea.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-17 15:30 ` Yuri Khan
  2021-10-17 15:37   ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-10-18  0:22   ` Hongyi Zhao
  2021-10-18  4:42     ` Yuri Khan
  2021-10-18 16:17     ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 2 replies; 19+ messages in thread
From: Hongyi Zhao @ 2021-10-18  0:22 UTC (permalink / raw)
  To: Yuri Khan; +Cc: help-gnu-emacs

On Sun, Oct 17, 2021 at 11:30 PM Yuri Khan <yuri.v.khan@gmail.com> wrote:
>
> On Sun, 17 Oct 2021 at 12:30, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> > The `fill-paragraph' will fill a paragraph at or after the point. But
> > I want to `fill-paragraph' on all the paragraphs in the currently
> > opened LaTeX document. Is there a convenient way to do this?
>
> Why do you even want that?

I use SyncTeX to do the forward and backward search, which is based on
linefeed separated line to locate the position in the source LaTeX
document. If a paragraph is arranged in one line, the backward search
will always jump to a very inaccurate location.

> When you compile,
> LaTeX will lay out your text by typographic rules.
> Meanwhile, you’ll have better experience
> treating your LaTeX source as source code —
> keep it in a VCS
> and format using semantic linefeeds[1].
>
> [1]: https://rhodesmill.org/brandon/2012/one-sentence-per-line/



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-18  0:22   ` Hongyi Zhao
@ 2021-10-18  4:42     ` Yuri Khan
  2021-10-18  4:50       ` Hongyi Zhao
                         ` (2 more replies)
  2021-10-18 16:17     ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 3 replies; 19+ messages in thread
From: Yuri Khan @ 2021-10-18  4:42 UTC (permalink / raw)
  To: Hongyi Zhao; +Cc: help-gnu-emacs

On Mon, 18 Oct 2021 at 07:22, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:

> > Why do you even want that?
>
> I use SyncTeX to do the forward and backward search, which is based on
> linefeed separated line to locate the position in the source LaTeX
> document. If a paragraph is arranged in one line, the backward search
> will always jump to a very inaccurate location.

I’m not suggesting
keeping each paragraph as a single long line.
What I’m suggesting is
dividing paragraphs into sentences
and sentences into phrases
while keeping each line reasonably short
but without trying to cram as much as possible into each line.

(This mail uses semantic line breaks,
as a demonstration.)



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-18  4:42     ` Yuri Khan
@ 2021-10-18  4:50       ` Hongyi Zhao
  2021-10-18 14:00         ` Eric S Fraga
  2021-10-18  8:56       ` Hongyi Zhao
  2021-10-18 16:21       ` Emanuel Berg via Users list for the GNU Emacs text editor
  2 siblings, 1 reply; 19+ messages in thread
From: Hongyi Zhao @ 2021-10-18  4:50 UTC (permalink / raw)
  To: Yuri Khan; +Cc: help-gnu-emacs

On Mon, Oct 18, 2021 at 12:43 PM Yuri Khan <yuri.v.khan@gmail.com> wrote:
>
> On Mon, 18 Oct 2021 at 07:22, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> > > Why do you even want that?
> >
> > I use SyncTeX to do the forward and backward search, which is based on
> > linefeed separated line to locate the position in the source LaTeX
> > document. If a paragraph is arranged in one line, the backward search
> > will always jump to a very inaccurate location.
>
> I’m not suggesting
> keeping each paragraph as a single long line.
> What I’m suggesting is
> dividing paragraphs into sentences
> and sentences into phrases
> while keeping each line reasonably short
> but without trying to cram as much as possible into each line.

I have a LaTeX source file provided by someone else which crams
everything into a line as a paragraph. So, I filed this topic here.

> (This mail uses semantic line breaks,
> as a demonstration.)



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-18  4:42     ` Yuri Khan
  2021-10-18  4:50       ` Hongyi Zhao
@ 2021-10-18  8:56       ` Hongyi Zhao
  2021-10-18 16:28         ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-10-18 16:21       ` Emanuel Berg via Users list for the GNU Emacs text editor
  2 siblings, 1 reply; 19+ messages in thread
From: Hongyi Zhao @ 2021-10-18  8:56 UTC (permalink / raw)
  To: Yuri Khan; +Cc: help-gnu-emacs

On Mon, Oct 18, 2021 at 12:43 PM Yuri Khan <yuri.v.khan@gmail.com> wrote:
>
> On Mon, 18 Oct 2021 at 07:22, Hongyi Zhao <hongyi.zhao@gmail.com> wrote:
>
> > > Why do you even want that?
> >
> > I use SyncTeX to do the forward and backward search, which is based on
> > linefeed separated line to locate the position in the source LaTeX
> > document. If a paragraph is arranged in one line, the backward search
> > will always jump to a very inaccurate location.
>
> I’m not suggesting
> keeping each paragraph as a single long line.
> What I’m suggesting is
> dividing paragraphs into sentences
> and sentences into phrases
> while keeping each line reasonably short
> but without trying to cram as much as possible into each line.
>
> (This mail uses semantic line breaks,
> as a demonstration.)

So the idea suggested by Emanuel Berg and you now can be combined into
the following:

Iterate the whole buffer line-by-line with a semantic line as the unit
block, and check
each line if it starts with '\' or not, e.g. with (looking-at
"\\\\"). When you find one "beg", start looking for where it
ends, and when you find that push (beg end) onto a list.

Then loop through the list and do (fill-region beg end) for each
list pair item ...

HZ



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-18  4:50       ` Hongyi Zhao
@ 2021-10-18 14:00         ` Eric S Fraga
  2021-10-19  1:21           ` Hongyi Zhao
  0 siblings, 1 reply; 19+ messages in thread
From: Eric S Fraga @ 2021-10-18 14:00 UTC (permalink / raw)
  To: help-gnu-emacs

On Monday, 18 Oct 2021 at 12:50, Hongyi Zhao wrote:
> I have a LaTeX source file provided by someone else which crams
> everything into a line as a paragraph. So, I filed this topic here.

Instead of actually filling the paragraphs, maybe use visual-line-mode
which "soft" fills the lines for display.

-- 
Eric S Fraga via Emacs 28.0.60 & org 9.5 on Debian 11.1




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-18  0:22   ` Hongyi Zhao
  2021-10-18  4:42     ` Yuri Khan
@ 2021-10-18 16:17     ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-18 16:17 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

> I use SyncTeX to do the forward and backward search, which
> is based on linefeed separated line to locate the position
> in the source LaTeX document. If a paragraph is arranged in
> one line, the backward search will always jump to a very
> inaccurate location.

Again, one shouldn't type in a way so the tools will work ...

One should have tools to work with the type!

Or, optimally, regardless of the way it is written. And isn't
the case already for most tools at least?

At least in lowercase ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-18  4:42     ` Yuri Khan
  2021-10-18  4:50       ` Hongyi Zhao
  2021-10-18  8:56       ` Hongyi Zhao
@ 2021-10-18 16:21       ` Emanuel Berg via Users list for the GNU Emacs text editor
  2 siblings, 0 replies; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-18 16:21 UTC (permalink / raw)
  To: help-gnu-emacs

Yuri Khan wrote:

>>> Why do you even want that?
>>
>> I use SyncTeX to do the forward and backward search, which
>> is based on linefeed separated line to locate the position
>> in the source LaTeX document. If a paragraph is arranged in
>> one line, the backward search will always jump to a very
>> inaccurate location.
>
> I’m not suggesting
> keeping each paragraph as a single long line.
> What I’m suggesting is
> dividing paragraphs into sentences
> and sentences into phrases
> while keeping each line reasonably short
> but without trying to cram as much as possible into each line.
>
> (This mail uses semantic line breaks,
> as a demonstration.)

No kidding ... what are the advantages with that you say?

But even so people are so used with paragraphs I don't know if
those would come into play anyway. Maybe if people did that
from day one?

To the OP (Hongyi Zhao), check out:
  https://dataswamp.org/~incal/emacs-init/wrap-search.el

Does it work to search backward with that? I think so :)

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-18  8:56       ` Hongyi Zhao
@ 2021-10-18 16:28         ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 19+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-10-18 16:28 UTC (permalink / raw)
  To: help-gnu-emacs

Hongyi Zhao wrote:

> So the idea suggested by Emanuel Berg and you now can be
> combined into the following:
>
> Iterate the whole buffer line-by-line with a semantic line
> as the unit block, and check each line if it starts with '\'
> or not, e.g. with (looking-at "\\\\"). When you find one
> "beg", start looking for where it ends, and when you find
> that push (beg end) onto a list.
>
> Then loop through the list and do (fill-region beg end) for
> each list pair item ...

Heh, interesting :)

But I think the advantage of semantic lines in terms of
filling is they will be so short that won't be necessary, if
one still does it maybe it will just be confusing (neither
fish nor fowl).

BTW one can optimize the algorithm proposed above by searching
for regexps instead of the line-by-line approach ... also it
is a good case for a DWIM interface, so, when used
interactively, the whole buffer will be filled that way only
if there is no region ...

;;; -*- lexical-binding: t -*-
;;;
;;; this file:
;;;   https://dataswamp.org/~incal/emacs-init/dwim.el

;; DWIM interface

(defun test-dwim (&optional beg end)
  (interactive (when (use-region-p)
                 (list (region-beginning) (region-end)) ))
  (let ((bg (or beg (point-min))) ; or just (point) here
        (ed (or end (point-max))) )
    (list bg ed) ; code here
    ))

;; test the interface

(when nil
  (save-excursion
    (set-mark   10)
    (goto-char 500)
    (call-interactively #'test-dwim) ) ; (10  500)
  (call-interactively #'test-dwim)     ; ( 1 1163)
  (test-dwim 30 90)                    ; (30   90)
  (test-dwim)                          ; ( 1 1163)
)

;; example function

(defun count-chars (&optional beg end)
  (interactive (when (use-region-p)
                 (list (region-beginning) (region-end)) ))
  (let*((bg   (or beg (point-min)))
        (ed   (or end (point-max)))
        (diff (- ed bg)) )
    (prog1
        diff
      (message "%d" diff) )))

;; test the example function

;; (call-interactively #'count-chars) ; 1162
;; (count-chars)                      ; 1162
;; (count-chars 10 40)                ; 30
;; (+ 1111 (count-chars))             ; 2273

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document.
  2021-10-18 14:00         ` Eric S Fraga
@ 2021-10-19  1:21           ` Hongyi Zhao
  0 siblings, 0 replies; 19+ messages in thread
From: Hongyi Zhao @ 2021-10-19  1:21 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: help-gnu-emacs

On Mon, Oct 18, 2021 at 10:01 PM Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
>
> On Monday, 18 Oct 2021 at 12:50, Hongyi Zhao wrote:
> > I have a LaTeX source file provided by someone else which crams
> > everything into a line as a paragraph. So, I filed this topic here.
>
> Instead of actually filling the paragraphs, maybe use visual-line-mode
> which "soft" fills the lines for display.

I've already enabled this mode, but it does nothing to help Synctex’s
reverse search.

HZ



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2021-10-19  1:21 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-17  5:30 Run `fill-paragraph' on all the paragraphs in the currently opened LaTeX document Hongyi Zhao
2021-10-17  6:23 ` Eli Zaretskii
2021-10-17  7:23   ` Hongyi Zhao
2021-10-17 10:25     ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-17 12:28       ` Hongyi Zhao
2021-10-17 12:42         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-17 15:30 ` Yuri Khan
2021-10-17 15:37   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-17 15:45     ` Yuri Khan
2021-10-17 17:22       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-18  0:22   ` Hongyi Zhao
2021-10-18  4:42     ` Yuri Khan
2021-10-18  4:50       ` Hongyi Zhao
2021-10-18 14:00         ` Eric S Fraga
2021-10-19  1:21           ` Hongyi Zhao
2021-10-18  8:56       ` Hongyi Zhao
2021-10-18 16:28         ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-18 16:21       ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-10-18 16:17     ` Emanuel Berg via Users list for the GNU Emacs text editor

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.