(defunxah-goto-line (&optionalzline-num)
"Move cursor to a line in current buffer or next buffer, at a number value under cursor.
If `universal-argument' is called first, goto the specified line number.
If `universal-argument' value is 1, ask for a line number.
Else use the number under cursor.
If no number is under cursor, ask for a line number.
If there is more than one pane (aka emacs window), goto the line number in that pane.
URL `http://xahlee.info/emacs/emacs/emacs_goto_line_other_buffer.html'
Created: 2025-04-10
Version: 2025-11-13"
(interactive
(ifcurrent-prefix-arg
(if (eq 1 (prefix-numeric-valuecurrent-prefix-arg))
(list (read-number"goto line number:"))
(list (prefix-numeric-valuecurrent-prefix-arg)))
nil))
(let ((xline-num
(ifzline-numzline-num
(let (xbegxend)
(skip-chars-backward"0-9")
(setqxbeg (point))
(skip-chars-forward"0-9")
(setqxend (point))
(if (eqxbegxend)
(progn (read-number"No number under cursor. goto line number:"))
(string-to-number (buffer-substring-no-propertiesxbegxend)))))))
(if (one-window-p)
nil
(other-window 1))
(goto-char (point-min))
(forward-linexline-num)))
(defunxah-goto-char (&optionalzposition)
"Move cursor to a position in current buffer or next buffer, at a number value under cursor.
If `universal-argument' is called first, goto the specified position.
If `universal-argument' value is 1, ask for a position.
Else use the number under cursor.
If no number is under cursor, ask for a position.
If there is more than one pane (aka emacs window), goto position in that pane.
URL `http://xahlee.info/emacs/emacs/emacs_goto_line_other_buffer.html'
Created: 2025-04-10
Version: 2025-11-13"
(interactive
(ifcurrent-prefix-arg
(if (eq 1 (prefix-numeric-valuecurrent-prefix-arg))
(list (read-number"goto position:"))
(list (prefix-numeric-valuecurrent-prefix-arg)))
nil))
(let ((xpos
(ifzpositionzposition
(let (xbegxend)
(skip-chars-backward"0-9")
(setqxbeg (point))
(skip-chars-forward"0-9")
(setqxend (point))
(if (eqxbegxend)
(progn (read-number"No number under cursor. goto position:"))
(string-to-number (buffer-substring-no-propertiesxbegxend)))))))
(if (one-window-p)
nil
(other-window 1))
(goto-charxpos)))