Emacs 计算给定行号和列号的文件偏移量

Emacs 计算给定行号和列号的文件偏移量,emacs,elisp,Emacs,Elisp,elisp中是否有一个内置函数,在给定文件名、行号和列号的情况下,该函数会将字符偏移量返回到文件中?内置函数?据我所知没有。这是你想要的吗 (defun foo (file line column &optional msgp) "..." (interactive (list (read-file-name "File: ") (read-number "Line: ") (read-n

elisp中是否有一个内置函数,在给定文件名、行号和列号的情况下,该函数会将字符偏移量返回到文件中?

内置函数?据我所知没有。这是你想要的吗

(defun foo (file line column &optional msgp)
  "..."
  (interactive (list (read-file-name "File: ") 
                     (read-number    "Line: ")
                     (read-number    "Columnn: ")
                     t))
  (with-current-buffer (find-file-noselect file)
    (goto-line line)
    (forward-char column)
    (when msgp (message "Char in file: %d" (point)))
    (point)))

这并不麻烦处理所选行上是否有足够的行或列,但您可以处理这些。

谢谢,这正是我需要的。