help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [External] : Find the longest word in the word list file.


From: Hongyi Zhao
Subject: Re: [External] : Find the longest word in the word list file.
Date: Wed, 11 Aug 2021 16:58:32 +0800

On Wed, Aug 11, 2021 at 2:47 PM <tomas@tuxteam.de> wrote:
>
> On Wed, Aug 11, 2021 at 11:00:53AM +0800, Hongyi Zhao wrote:
> > On Wed, Aug 11, 2021 at 9:51 AM Drew Adams <drew.adams@oracle.com> wrote:
>
> [...]
>
> > Thank you for your solution, but it seems so complicated to me.
>
> You prefer something to hack on yourself ;-)
>
> OK, here's one attempt. But be careful. I just tested it
> twice, so there may be two bugs left :-)
>
>   (defun goto-longest-line ()
>     (let ((maxpos)
>           (maxlen 0))
>       (goto-char (point-min))
>       (while
>           (let ((len (- (line-end-position)
>                         (line-beginning-position))))
>             (when (> len maxlen)
>               (setq maxlen len
>                     maxpos (point)))
>             (= (forward-line) 0)))
>       (goto-char maxpos)))

Wonderful. How to test it with the word list file opened? I try to put
the above code on the minibuffer of the opened word list file's frame,
and then hit `M-:', but it doesn't work.

Best, Hongyi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]