[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Try to understand the ora-company-number function again.
From: |
Hongyi Zhao |
Subject: |
Try to understand the ora-company-number function again. |
Date: |
Thu, 21 Oct 2021 14:54:37 +0800 |
I try to understand the ora-company-number function [1] again:
(defun ora-company-number ()
"Forward to `company-complete-number'.
Unless the number is potentially part of the candidate.
In that case, insert the number."
(interactive)
(let* ((k (this-command-keys))
(re (concat "^" company-prefix k)))
(if (or (cl-find-if (lambda (s) (string-match re s))
company-candidates)
(> (string-to-number k)
(length company-candidates))
(looking-back "[0-9]+\\.[0-9]*" (line-beginning-position)))
(self-insert-command 1)
(company-complete-number
(if (equal k "0")
10
(string-to-number k))))))
I've figured out all the intention of the above code snippet except
the following line:
(looking-back "[0-9]+\\.[0-9]*" (line-beginning-position)
I can't understand why the regexp used here must be written in this
form. Any hints will be appreciated.
[1]
https://github.com/abo-abo/oremacs/blob/0c5f3284acedc966948cbb930e779af5189fd54e/modes/ora-company.el#L22
Regards
--
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province
- Try to understand the ora-company-number function again.,
Hongyi Zhao <=
- Re: Try to understand the ora-company-number function again., Hongyi Zhao, 2021/10/21
- Re: Try to understand the ora-company-number function again., Hongyi Zhao, 2021/10/21
- Re: Try to understand the ora-company-number function again., Hongyi Zhao, 2021/10/21
- Re: Try to understand the ora-company-number function again., Hongyi Zhao, 2021/10/21
- Re: Try to understand the ora-company-number function again., Hongyi Zhao, 2021/10/21
- Re: Try to understand the ora-company-number function again., Hongyi Zhao, 2021/10/21
- Re: Try to understand the ora-company-number function again., Hongyi Zhao, 2021/10/26
- Re: Try to understand the ora-company-number function again., Emanuel Berg, 2021/10/26
- Re: Try to understand the ora-company-number function again., Hongyi Zhao, 2021/10/26
- Re: Try to understand the ora-company-number function again., Emanuel Berg, 2021/10/27