Git Product home page Git Product logo

company-reftex's People

Contributors

anuragm avatar atreyasha avatar duianto avatar thebb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

company-reftex's Issues

Issues setting up company-reftex

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!

Reftex label candidates are not automatically refreshed

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:

;; Labels
(defun company-reftex-label-candidates (prefix)
"Find all label candidates matching PREFIX."
(reftex-access-scan-info)
(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))))

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)))) 

[Feature-Request]: Expanding company-reftex-citations

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.

(defun company-reftex-citation-candidates (prefix)
"Find all citation candidates matching PREFIX."
(reftex-access-scan-info)
;; Reftex will ask for a regexp by using `completing-read'
;; Override this programatically with a regexp from the prefix
(cl-letf (((symbol-function 'reftex--query-search-regexps)
(lambda (_) (list (regexp-quote prefix)))))
(let* ((bibtype (reftex-bib-or-thebib))
(candidates
(cond
((eq 'thebib bibtype)
(reftex-extract-bib-entries-from-thebibliography
(reftex-uniquify
(mapcar 'cdr
(reftex-all-assq
'thebib (symbol-value reftex-docstruct-symbol))))))
((eq 'bib bibtype)
(reftex-extract-bib-entries (reftex-get-bibfile-list)))
(reftex-default-bibliography
(reftex-extract-bib-entries (reftex-default-bibliography))))))
(cl-loop
for entry in candidates
collect
(let ((key (substring-no-properties (car entry))))
(company-reftex-annotate
key
(when company-reftex-annotate-citations
(reftex-format-citation entry company-reftex-annotate-citations))))))))

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.

`company-reftex-citations` opens bibliography file

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.

fuzzy matching not working (missing feature?)

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?

Using customizable regexp in ``company-reftex-labels``

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).

Customizable citation annotation

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.