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: tomas
Subject: Re: [External] : Find the longest word in the word list file.
Date: Wed, 11 Aug 2021 08:46:43 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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)))

Cheers
 - t

Attachment: signature.asc
Description: Digital signature


reply via email to

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