On Wed, Aug 11, 2021 at 11:00:53AM +0800, Hongyi Zhao wrote: > On Wed, Aug 11, 2021 at 9:51 AM Drew Adams 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