thebb / company-reftex Goto Github PK
View Code? Open in Web Editor NEWRefTeX backends for company-mode
License: GNU General Public License v3.0
RefTeX backends for company-mode
License: GNU General Public License v3.0
Hi,
This package seems awesome and I'd love to see it working but am having difficulty.
It seems the package is installed properly, but the appropriate functions are not called when \ref{ or \eqref{ are typed.
If I type M-x c-r-l at \ref{ I do see an autocomplete menu.
Any idea why the autocomplete is not 'auto' in my case?
To try and isolate the issue, I made a virtual machine instance and installed stock Debian 10.8 and got their default emacs (version is 26.1)
Here is my .emacs
(require 'package)
(require 'reftex)
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
(add-to-list 'package-archives
'("melpa-stable" . "https://melpa.org/packages/") t)
(package-initialize)
(add-hook 'Latex-mode-hook 'turn-on-reftex)
(add-hook 'latex-mode-hook 'turn-on-reftex)
(custom-set-variables
'(package-selected-packages (quote (company-reftex company))))
(custom-set-faces)
(use-package company
:ensure t
:custom
(company-idle-delay 0.0)
:config (global-company-mode 1))
(eval-after-load "company"
'(add-to-list
'company-backends
'company-reftex-labels
'company-reftex-citations))
If someone could provide some tips or a minimal example of a working .emacs that would be very helpful. Thank you!
Hi @TheBB,
Quick question pertaining to a feature request. As of now, when I use company-reftex
to search for label candidates, I notice that the selection of labels does not get updated after starting my emacs
session. To overcome this I normally have to execute reftex-parse-all
to manually refresh the selection of labels. Do you or others also experience this issue or is there some easy workaround?
I found this to be the relevant section of code:
company-reftex/company-reftex.el
Lines 224 to 232 in 291c283
I noticed that the following edit on line 229 fixes the issue for me, and would be happy to submit a PR. WDYT?
;; Labels
(defun company-reftex-label-candidates (prefix)
"Find all label candidates matching PREFIX."
(reftex-access-scan-info)
(reftex-parse-all)
(cl-loop for entry in (symbol-value reftex-docstruct-symbol)
if (and (stringp (car entry)) (string-prefix-p prefix (car entry)))
collect
(company-reftex-annotate (car entry) (cl-caddr entry))))
Hello, thank you for developing this awesome tool!
I have a question regarding a possible feature expansion for company-reftex-citations
. As per line 183, any input prefix is escaped for text searches.
company-reftex/company-reftex.el
Lines 177 to 204 in 275ef70
As a result, when I enter an empty string or an arbitrary placeholder such as .*
, company-reftex-citations
does not return any candidates. Do you reckon it would be possible to loosen the constraints, such that inputting an empty string or .*
returns all possible citation candidates? The user can then narrow down the list by typing further prefixes.
I would be happy to develop this, if this feature is of interest. Thank you for your time.
On the first time it's used to complete a reference, company-reftex-citations
makes Emacs open the bib file in the background without the user explicitly intending to do so.
To reproduce, open a tex file with a bibliograhy and complete a reference inside, e.g. \cite{}
. In my case, C-x C-b at this point lists the bibliography file among open buffers.
Hi there!
It seems that the backend doesn't support fuzzy matching: I want to be able to match the following citation with key smith2020anexamplecitation
by typing sm20
for example.
I don't understand elisp very well, but from reading the code, it seems that this is not supported. Would it be possible to add it?
Just a minor request: Can company-reftex-labels
use a customizable regexp for its prefix command instead of the hardcoded string? This way it would be possible to support LaTeX packages like cleveref
with their additional ref commands (like \cref
and \Cref
).
It would be nice to make company-reftex-annotate-labels
a string, which is then passed to reftex-format-citation
to format the annotation (see also company-reftex-citations-regexp
). The default would be "%t"
.
Also, I think it would be no harm to let company-reftex-citations-regexp
match anything of the form \\[[:alpha:]]*cite
, so it catches \textcite
, \parencite
, etc.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.