Send Ebib-users mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/ebib-users
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Ebib-users digest..."
Today's Topics:
1. Re: No valid filename found in field 'file' (Robbie Morrison)
2. Re: 'ebib-file-search-dirs' documentation suggestion
(Robbie Morrison)
3. Re: 'ebib-file-search-dirs' documentation suggestion
(Joost Kremers)
4. searching across multiple real databases (Robbie Morrison)
5. Re: searching across multiple real databases (Joost Kremers)
6. Re: 'ebib-file-search-dirs' documentation suggestion
(Joost Kremers)
----------------------------------------------------------------------
Message: 1
Date: Mon, 13 Aug 2012 20:13:23 +1200
From: "Robbie Morrison" <[email protected]>
Subject: Re: [Ebib-users] No valid filename found in field 'file'
To: "Jeffrey Spencer" <[email protected]>
Cc: ebib users <[email protected]>
Message-ID:
<[email protected]>
Content-Type: text/plain;charset=iso-8859-1
Hello Jeff
------------------------------------------------------------
To: "Discussion of issues relating to Ebib."
<[email protected]>
Subject: Re: [Ebib-users] No valid filename found in field 'file'
From: Jeffrey Spencer <[email protected]>
Date: Tue, 7 Aug 2012 08:37:25 +1000
------------------------------------------------------------
> No worries and thanks for the heads up. I will try to
> get the regexp working with ebib-file-regexp but not
> the greatest with figuring out regexp.
Try 're-builder' in emacs. Add some filenames to a
buffer, do 'M-x re-builder', and start typing regexes.
Highly recommended. See also:
http://www.emacswiki.org/emacs/ReBuilder
If you want some help formulating regexes, post back
here and I will if I can assist.
cheers, Robbie
---
Robbie Morrison
PhD student -- policy-oriented energy system simulation
Technical University of Berlin (TU-Berlin), Germany
University email (redirected) : [email protected]
Webmail (preferred) : [email protected]
[from Webmail client]
------------------------------
Message: 2
Date: Wed, 15 Aug 2012 11:50:43 +1200
From: "Robbie Morrison" <[email protected]>
Subject: Re: [Ebib-users] 'ebib-file-search-dirs' documentation
suggestion
To: "ebib users" <[email protected]>
Message-ID:
<[email protected]>
Content-Type: text/plain;charset=iso-8859-1
Hello all
Just a correction in case any one is reading this
thread in the future.
Earlier I wrote:
(setq ebib-file-search-dirs
"~/path/to/bib/files")
That should be a elisp list:
(setq ebib-file-search-dirs
(list "~/path/to/bib/files"))
Possible improvement -- code like this would protect
against this kind of user mistake (and yes I know I
could have used Configure):
(unless (listp ebib-file-search-dirs)
(warn "configuration variable ebib-file-search-dirs must be a list"))
also for 'ebib-preload-bib-files'
Otherwise 'ebib' gives the following somewhat
misleading error message:
"No valid filename found in field `file'"
Just a suggestion. No strong feeling on this.
Robbie
---
Robbie Morrison
PhD student -- policy-oriented energy system simulation
Institute for Energy Engineering (IET)
Technical University of Berlin (TU-Berlin), Germany
University email (redirected) : [email protected]
Webmail (preferred) : [email protected]
[from Webmail client]
------------------------------
Message: 3
Date: Thu, 16 Aug 2012 10:21:33 +0200
From: Joost Kremers <[email protected]>
Subject: Re: [Ebib-users] 'ebib-file-search-dirs' documentation
suggestion
To: ebib users <[email protected]>
Message-ID: <20120816082133.GA5278@Darkstar>
Content-Type: text/plain; charset=utf-8
Hi Robbie,
On Wed, Aug 15, 2012 at 11:50:43AM +1200, Robbie Morrison wrote:
> Possible improvement -- code like this would protect
> against this kind of user mistake (and yes I know I
> could have used Configure):
>
> (unless (listp ebib-file-search-dirs)
> (warn "configuration variable ebib-file-search-dirs must be a list"))
>
> also for 'ebib-preload-bib-files'
>
> Otherwise 'ebib' gives the following somewhat
> misleading error message:
>
> "No valid filename found in field `file'"
>
> Just a suggestion. No strong feeling on this.
I see your point, but to be consistent, I'd have to include similar checks
for all customizable variables. However, one of the reasons for using
Customize is that it makes sure the variables have proper values, so
there's really no need for such checks, IMHO.
On the other hand, the error message isn't helpful at all, I agree. I'll
have to think about the best way to make the code more robust, though.
Best,
Joost
--
Joost Kremers
Life has its moments
------------------------------
Message: 4
Date: Sun, 19 Aug 2012 01:13:31 +1200
From: "Robbie Morrison" <[email protected]>
Subject: [Ebib-users] searching across multiple real databases
To: "ebib users" <[email protected]>
Message-ID:
<[email protected]>
Content-Type: text/plain;charset=iso-8859-1
Hello Joost and list
This posting relates to searching across multiple
databases. Unless I have misread the
documentation badly (always a possibility), basic
emacs-based searches and advanced searching
(resulting in virtual databases) are only
possible within the one database. Is this
correct?
I would like to work across six BibTeX files.
It so, there are two possible fixes: concatenate
the BibTeX files beforehand. Or offer users a
'super' database, a union of the existing real
databases. Call it super, logical, or virtual, as
you like. In fact, 'logical' has some merits.
Anyway, I hacked a bit of 'ebib.el' to try and get
something happening. The following patch FAILS to
work, but did run. You should get the drift,
anyhow.
My questions are two-fold:
* is this functionality needed ?
* is this functionality possible ?
It yes to both, I may go on hacking. Else, I will
give up and simply run 'cat' on my BibTeX files to
produce on single real (physical) database and
leave it at that.
many thanks in advance, Robbie
CAUTION: patch is also hand-edited so may not take
--- ebib.el.orig 2012-08-18 00:36:40.663700389 +0200
+++ ebib.el 2012-08-18 04:33:38.433636738 +0200
@@ -1518,6 +1518,7 @@
(ebib-key index "&" ebib-virtual-db-and)
(ebib-key index "|" ebib-virtual-db-or)
(ebib-key index "~" ebib-virtual-db-not)
+(ebib-key index "+" ebib-virtual-db-union)
(ebib-key index ";" ebib-prefix-map)
(ebib-key index "a" ebib-add-entry)
(ebib-key index "b" ebib-index-scroll-down)
@@ -1746,13 +1747,16 @@
(message "%s found! Press `l' to check Ebib log buffer." (nth
ebib-log-error '("Warnings" "Errors"))))
(ebib-log 'log ""))
-(defun ebib-merge-bibtex-file ()
+(defun ebib-merge-bibtex-file (bibfile)
"Merges a BibTeX file into the database."
(interactive)
- (unless (edb-virtual ebib-cur-db)
+; (unless (edb-virtual ebib-cur-db)
+ (unless nil ; robbie 18-Aug-2012
(if (not ebib-cur-db)
(error "No database loaded. Use `o' to open a database")
- (let ((file (read-file-name "File to merge: ")))
+ (let ((file bibfile)) ; could well be 'nil'
+ (unless file
+ (setq file (read-file-name "File to merge: ")))
(setq ebib-log-error nil) ; we haven't found any errors
(ebib-log 'log "%s: Merging file %s" (format-time-string
"%d-%b-%Y: %H:%M:%S") (edb-filename ebib-cur-db))
(with-temp-buffer
@@ -2889,6 +2893,51 @@
(ebib-log 'message "invoking: %s %s" "find-file" file-full-path)
(find-file file-full-path))))))
+; robbie 18-Aug-2012
+; from 'ebib-virtual-db-and'
+(defun ebib-virtual-db-union (arg)
+ "Combine open databased into a single virtual database.
+If the current database is a virtual database already,
+ignore the command."
+ (interactive "p") ; cannot think of a reason
for this
+ (ebib-log 'message "creating virtual union database")
+
+ (let* ((dbname "union" )
+ (new-db (ebib-create-new-database nil) ) ; create new
database, adds to census
+ (count 0 ))
+
+ (setf (edb-virtual new-db) t) ; mark
virtual, 't' also works
+ (setf (edb-filename new-db) nil)
+ (setf (edb-name new-db) (concat "V:" dbname))
+ (setf (edb-modified new-db) nil)
+ (setf (edb-make-backup new-db) nil)
+
+ ;; loop non-virtual databases
+ (dolist (db ebib-databases)
+ (ebib-execute-when
+ ((database) ; for some reason (real-db)
did not seem to take
+ (setq ebib-cur-db db) ; change focus
+ (unless (edb-virtual db) ; skip virtual databases
+ (let ((ebib-merge-bibtex-filename (edb-filename ebib-cur-db) ))
+ (ebib-merge-bibtex-file ebib-merge-bibtex-filename)
+ (incf count)
+ (ebib-log 'message "current database %S" ebib-cur-db)
+ (ebib-log 'message "current filename %s\n" (prin1-to-string
ebib-merge-bibtex-filename))
+ )))))
+ (ebib-log 'message "traversed %d databases\n" count)
+
+ ;; file virtual database
+ (ebib-fill-entry-buffer) ; fill entry buffer
+ (ebib-fill-index-buffer) ; fill index buffer
+ ))
+
+; 'ebib-merge-bibtex-file'
+; 'ebib-save-all-databases' uses 'mapc'
+
(defun ebib-virtual-db-and (not)
"Filters entries into a virtual database.
If the current database is a virtual database already, perform a
---
Robbie Morrison
PhD student -- policy-oriented energy system simulation
Technical University of Berlin (TU-Berlin), Germany
University email (redirected) : [email protected]
Webmail (preferred) : [email protected]
[from Webmail client]
------------------------------
Message: 5
Date: Sat, 18 Aug 2012 19:27:51 +0200
From: Joost Kremers <[email protected]>
Subject: Re: [Ebib-users] searching across multiple real databases
To: [email protected]
Message-ID: <20120818172751.GA24409@Darkstar>
Content-Type: text/plain; charset=utf-8
hi robbie,
> This posting relates to searching across multiple
> databases. Unless I have misread the
> documentation badly (always a possibility), basic
> emacs-based searches and advanced searching
> (resulting in virtual databases) are only
> possible within the one database. Is this
> correct?
yup.
> I would like to work across six BibTeX files.
i once though i'd do that to, so i added the possibility to work with more
than one .bib file to ebib. but then i found it more practical to keep all
my biblography entries in one file... ;-)
anyway, i never thought about searching across more than one file, but it
can certainly be useful.
> My questions are two-fold:
>
> * is this functionality needed ?
well, *you* need it, so that would be a yes. ;-)
> * is this functionality possible ?
i don't see why not. the question one needs to ask is what would be the
best way to do it? IIUC, you want to create a union db, which is like a
virtual db, but which still allows a virtual db to be created from it,
right? that would probably be the most straightforward way, and not too
difficult to implement.
a few comments to your patch:
> --- ebib.el.orig 2012-08-18 00:36:40.663700389 +0200
> +++ ebib.el 2012-08-18 04:33:38.433636738 +0200
> @@ -1518,6 +1518,7 @@
> (ebib-key index "&" ebib-virtual-db-and)
> (ebib-key index "|" ebib-virtual-db-or)
> (ebib-key index "~" ebib-virtual-db-not)
> +(ebib-key index "+" ebib-virtual-db-union)
> (ebib-key index ";" ebib-prefix-map)
> (ebib-key index "a" ebib-add-entry)
> (ebib-key index "b" ebib-index-scroll-down)
> @@ -1746,13 +1747,16 @@
> (message "%s found! Press `l' to check Ebib log buffer." (nth
> ebib-log-error '("Warnings" "Errors"))))
> (ebib-log 'log ""))
>
> -(defun ebib-merge-bibtex-file ()
> +(defun ebib-merge-bibtex-file (bibfile)
> "Merges a BibTeX file into the database."
> (interactive)
> - (unless (edb-virtual ebib-cur-db)
> +; (unless (edb-virtual ebib-cur-db)
> + (unless nil ; robbie 18-Aug-2012
this will always be true... ;-)
> (if (not ebib-cur-db)
> (error "No database loaded. Use `o' to open a database")
> - (let ((file (read-file-name "File to merge: ")))
> + (let ((file bibfile)) ; could well be 'nil'
> + (unless file
> + (setq file (read-file-name "File to merge: ")))
> (setq ebib-log-error nil) ; we haven't found any errors
> (ebib-log 'log "%s: Merging file %s" (format-time-string "%d-%b-%Y:
> %H:%M:%S") (edb-filename ebib-cur-db))
> (with-temp-buffer
> @@ -2889,6 +2893,51 @@
> (ebib-log 'message "invoking: %s %s" "find-file" file-full-path)
> (find-file file-full-path))))))
>
> +; robbie 18-Aug-2012
> +; from 'ebib-virtual-db-and'
> +(defun ebib-virtual-db-union (arg)
> + "Combine open databased into a single virtual database.
> +If the current database is a virtual database already,
> +ignore the command."
> + (interactive "p") ; cannot think of a reason for
> this
yup... you could get rid of the "p" and of the arg in the defun.
> + (ebib-log 'message "creating virtual union database")
> +
> + (let* ((dbname "union" )
> + (new-db (ebib-create-new-database nil) ) ; create new
> database, adds to census
> + (count 0 ))
> +
> + (setf (edb-virtual new-db) t) ; mark
> virtual, 't' also works
the union db shouldn't be marked virtual if it should be possible to create
a virtual db from it. OTOH, we cannot set edb-virtual to nil, because that
would mean the user can add/delete/modify entries in the union db, which is
not what you want. (since the most efficient way to populate the union db
is to populate edb-database with the same objects that are in the real dbs,
i.e., not with copies, modifying an entry in the union db would modify it
in the original db, without the latter getting marked modified. that
wouldn't be good... ;-) )
so what we'd need to do is mark the union db in some special way, say with
the symbol 'union or the string "union" or something as the value of
edb-virtual. that would, however, require modifications to
ebib-execute-helper, so that the union db is not recognized as a virtual
db.
> + (setf (edb-filename new-db) nil)
> + (setf (edb-name new-db) (concat "V:" dbname))
I wouldn't concat a "V:" to the db's name, just call it "Union". It's not
the same thing as a virtual db, after all. :-)
> + (setf (edb-modified new-db) nil)
> + (setf (edb-make-backup new-db) nil)
> +
> + ;; loop non-virtual databases
> + (dolist (db ebib-databases)
> + (ebib-execute-when
you don't need ebib-execute-when here, since you're checking inside the
loop whether each db is virtual or not.
> + ((database) ; for some reason (real-db) did
> not seem to take
presumably because ebib-execute-when (or more precisely,
ebib-execute-helper) checks ebib-cur-db, but that variable is set only in
the body of ebib-execute-when, after it has performed its checks. (BTW,
it's not necessary to set ebib-cur-db in the loop, since that variable
basically determines which db is displayed to the user, and here you're
just going through them to get their data, not to display them.)
> + (setq ebib-cur-db db) ; change focus
> + (unless (edb-virtual db) ; skip virtual databases
> + (let ((ebib-merge-bibtex-filename (edb-filename ebib-cur-db) ))
> + (ebib-merge-bibtex-file ebib-merge-bibtex-filename)
since the union db is simply meant as a transitory db, i wouldn't bother
with ebib-merge-bibtex-file. it should be sufficient to add the hash table
entries of edb-database of each db to the edb-database hash table of the
new union db, and after that's done for all dbs, set edb-keys-list,
edb-cur-entry and edb-n-entries.
> + (incf count)
> + (ebib-log 'message "current database %S" ebib-cur-db)
> + (ebib-log 'message "current filename %s\n" (prin1-to-string
> ebib-merge-bibtex-filename))
> + )))))
> + (ebib-log 'message "traversed %d databases\n" count)
> +
> + ;; file virtual database
> + (ebib-fill-entry-buffer) ; fill entry buffer
> + (ebib-fill-index-buffer) ; fill index buffer
> + ))
before you do this, you need to set ebib-cur-db to the new union db.
otherwise you'll just display the database that was current before creating
the union db.
anyway, it should definitely be possible to do what you suggest, and if you
hack up some code, i'd definitely be interested in adding it to ebib.
best,
joost
--
Joost Kremers
Life has its moments
------------------------------
Message: 6
Date: Sat, 18 Aug 2012 22:27:18 +0200
From: Joost Kremers <[email protected]>
Subject: Re: [Ebib-users] 'ebib-file-search-dirs' documentation
suggestion
To: [email protected]
Message-ID: <20120818202718.GA26369@Darkstar>
Content-Type: text/plain; charset=utf-8
On Thu, Aug 16, 2012 at 10:21:33AM +0200, Joost Kremers wrote:
> On the other hand, the error message isn't helpful at all, I agree. I'll
> have to think about the best way to make the code more robust, though.
I've made some changes so that Ebib now gives some more feedback about what
it's doing when browsing a url or calling a viewer for an external file.
Also, if something goes wrong, the error message should be a bit more
informative than "no valid url/filename found".
J.
--
Joost Kremers
Life has its moments
------------------------------
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
------------------------------
_______________________________________________
Ebib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ebib-users
End of Ebib-users Digest, Vol 18, Issue 3
*****************************************