unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Emacs 27-28, improvements to BibTeX
@ 2020-10-24  2:47 Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-24  2:59 ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-24  2:47 UTC (permalink / raw)
  To: help-gnu-emacs

In Emacs 27, there has been some improvements to bibtex-mode, for
example

(defun bibtex-next-entry (&optional arg)
  "Move point ARG entries forward.
ARG defaults to one.  Called interactively, ARG is the prefix
argument."
  (interactive "p")
  (bibtex-end-of-entry)
  (when (re-search-forward bibtex-entry-maybe-empty-head nil t (or arg 1))
    (goto-char (match-beginning 0))))

(defun bibtex-previous-entry (&optional arg)
  "Move point ARG entries backward.
ARG defaults to one.  Called interactively, ARG is the prefix
argument."
  (interactive "p")
  (bibtex-beginning-of-entry)
  (when (re-search-backward bibtex-entry-maybe-empty-head nil t (or arg 1))
    (goto-char (match-beginning 0))))

It is interesting, since I've had for a while, and also posted on MLs,
this

;; (defun bibtex-next-entry ()
;;   (interactive)
;;   (end-of-line)
;;   (if (re-search-forward "@" nil t)
;;       (goto-char (match-beginning 0))
;;     (bibtex-prev-entry)
;;     (message "this is the last entry") ))
;;
;; (defun bibtex-prev-entry ()
;;   (interactive)
;;   (re-search-backward "@" nil t) )

(now commented out, since not in use)

Sure, I'll remove it, your version seems more ... something!

BTW a LOT of people seems to be working on bibtex stuff? Is this a new
thing? I ask because I've posted bibtex stuff for several years here
and on gmane.emacs.devel and never got a single reply so I thought
I was the only one who used it?

Well, anyway, this is great! Take a look here

  https://dataswamp.org/~incal/emacs-init/bibtex-get.el

and see if you have implemented something else that I can remove!

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Emacs 27-28, improvements to BibTeX
  2020-10-24  2:47 Emacs 27-28, improvements to BibTeX Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-24  2:59 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-24  3:04   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-24  8:25   ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-24  2:59 UTC (permalink / raw)
  To: help-gnu-emacs

> In Emacs [27-28], there has been some improvements to bibtex-mode,
> for example [...]
>
> BTW a LOT of people seems to be working on bibtex stuff? Is this
> a new thing? I ask because I've posted bibtex stuff for several
> years here and on gmane.emacs.devel and never got a single reply so
> I thought I was the only one who used it?

This command

  $ cat ChangeLog.{1..3} | \grep bibtex | grep -v org-bibtex | wc -l

tells me that Emacs 28 has _forty-nine_ (49) improvements to bibtex.el

Holy socks!

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Emacs 27-28, improvements to BibTeX
  2020-10-24  2:59 ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-24  3:04   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-24  3:18     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-24  8:25   ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-24  3:04 UTC (permalink / raw)
  To: help-gnu-emacs

> This command
>
>   $ cat ChangeLog.{1..3} | \grep bibtex | grep -v org-bibtex | wc -l
>
> tells me that Emacs 28 has _forty-nine_ (49) improvements to bibtex.el
>
> Holy socks!

Indeed, the same command for Emacs 26: only 12

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Emacs 27-28, improvements to BibTeX
  2020-10-24  3:04   ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-24  3:18     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-24  4:11       ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-24  8:26       ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-24  3:18 UTC (permalink / raw)
  To: help-gnu-emacs

>> This command
>>
>>   $ cat ChangeLog.{1..3} | \grep bibtex | grep -v org-bibtex | wc -l
>>
>> tells me that Emacs 28 has _forty-nine_ (49) improvements to bibtex.el
>>
>> Holy socks!
>
> Indeed, the same command for Emacs 26: only 12

Same command for Emacs 27 [1] : 49

hm, same as for Emacs 28 ... fishy

Actually, what separates the ChangeLog1s are only the correction of
three spelling mistakes!

What's going on?

And maybe we should have a ChangeLogChangeLog, that logs the changes
to the changelog?


[1] http://ftp.acc.umu.se/mirror/gnu.org/gnu/emacs/emacs-27.1.tar.xz

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Emacs 27-28, improvements to BibTeX
  2020-10-24  3:18     ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-24  4:11       ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-24  8:26       ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-10-24  4:11 UTC (permalink / raw)
  To: help-gnu-emacs

If you wonder why I care about `bibtex-mode' - I use it every day!
(almost)

Because I have a file to keep track of my reading, I started it summer
2014 and it now has 432 entries! Not bad for a guy who everyone tells
to read stuff :)

  https://dataswamp.org/~incal/books/books.bib

I use this

  (+ (how-many "^@book" (point)) (how-many "^@periodical" (point)))

to find out how many! Something for bibtex-mode, maybe?

Another thing I use all the time is "new-book" [1] - the source yanked
last in this post - hm, I wonder why I set it up that way? Anyway, it
is very useful! It outputs this

  @book{,
    author     = {x},
    isbn       = {},
    publisher  = {},
    title      = {},
    year       = {}
  }

with x denoting the position of point after invocation!

I then tab and backtab between fields until it is complete, then
I hit M-n for "bibtex-insert-autokey-check-isbn" (source last). As you
can see, that is integrated with my verifiers of ISBN and ISSNs [3]

I know what you are thinking: ain't it cool stuff!

(defun create-book (&optional title author publisher year isbn)
  "Insert a Bibtex book at point.
\nOptional insert TITLE, AUTHOR, PUBLISHER, YEAR, and ISBN.
\nTo insert an entry with blank field, use \\[new-book]"
  (interactive "stitle: \nsauthor: \nspublisher: \nsyear: \nsISBN: ")
  (let*((bib-str-nils (format "@book{,\n  author     = {%s},\n  isbn       = {%s},\n  publisher  = {%s},\n  title      = {%s},\n  year       = {%s}\n}" author isbn publisher title year))
        (bib-str      (replace-regexp-in-string "{nil}" "{}" bib-str-nils)) )
    (beginning-of-line)
    (let ((start (point)))
      (insert bib-str)
      (goto-char (+ start 24) )))) ; point at first field

(defun new-book ()
  "Insert a Bibtex book, with blank field, at point.
\nsee `create-book'"
  (interactive)
  (create-book) )

(defun bibtex-insert-autokey-check-isbn ()
  (interactive)
  (let*((ids (list (bibtex-autokey-get-field "issn")
                   (bibtex-autokey-get-field "isbn") ))
        (issn (car  ids))
        (isbn (cadr ids)) )
    (cond ((not (empty-string-p issn)) (issn-verify issn))
          ((not (empty-string-p isbn)) (isbn-verify isbn)) )
    (bibtex-insert-autokey) ))
(defalias 'bibtex-insert-autokey-check-issn #'bibtex-insert-autokey-check-isbn)

;; asked about this on gmane.emacs.devel and gmane.emacs.help
(defun bibtex-insert-autokey ()
  (re-search-forward "^}")
  (let ((title (bibtex-autokey-get-title)))
    (bibtex-beginning-of-entry)
    (search-forward "{")
    (insert title)
    (kill-line)
    (insert ",") ))


[1] https://dataswamp.org/~incal/emacs-init/my-bibtex.el line 132

[2] https://dataswamp.org/~incal/emacs-init/isbn-verify.el
    https://dataswamp.org/~incal/emacs-init/issn-verify.el

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Emacs 27-28, improvements to BibTeX
  2020-10-24  2:59 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-24  3:04   ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-24  8:25   ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2020-10-24  8:25 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 24 Oct 2020 04:59:57 +0200
> From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> 
> This command
> 
>   $ cat ChangeLog.{1..3} | \grep bibtex | grep -v org-bibtex | wc -l
> 
> tells me that Emacs 28 has _forty-nine_ (49) improvements to bibtex.el

Caveat emptor: the ChangeLog.3 file is only generated when a release
is made, otherwise it lags after the actual development.  Depending on
how the folks who produced that snapshot did it, the file may or may
not be up-to-date.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Emacs 27-28, improvements to BibTeX
  2020-10-24  3:18     ` Emanuel Berg via Users list for the GNU Emacs text editor
  2020-10-24  4:11       ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2020-10-24  8:26       ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2020-10-24  8:26 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 24 Oct 2020 05:18:06 +0200
> From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> 
> Same command for Emacs 27 [1] : 49
> 
> hm, same as for Emacs 28 ... fishy

So, as I envisioned, you are looking at an outdated ChangeLog.3 file.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-10-24  8:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-24  2:47 Emacs 27-28, improvements to BibTeX Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-24  2:59 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-24  3:04   ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-24  3:18     ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-24  4:11       ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-24  8:26       ` Eli Zaretskii
2020-10-24  8:25   ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).