Thread: [Refdb-devel] Updated Emacs package, syntax highlighting, new name
Status: Beta
Brought to you by:
mhoenicka
From: Michael S. <sm...@xm...> - 2003-12-12 11:47:23
Attachments:
refdb-mode.el
|
Attached is an update of the Emacs package, renamed it "refdb-mode". You'll need to change the require statement in your .emacs to: (require 'refdb-mode) And any variables you have set in your .emacs will need to be changed to, or example: (setq refdb-database "DATABASE") That is, just drop the "menu-" part from the variable name. Syntax highlighting ------------------- The main change in this version is that it now indirectly does syntax highlighting. It works just by trying to put the output buffer into an appropriate mode based on output type. For example: - for XML output types, it puts the output buffer into nxml-mode if you have it, sgml-mode (psgml) otherwise - for HTML or DocBook SGML, sgml-mode (psgml) - for BibTeX, bibtex-mode - for RIS, ris-mode http://cvs.sourceforge.net/viewcvs.py/*checkout*/refdb/refdb/site-lisp/ris.el Window splitting ---------------- I added a new variable, refdb-split-for-getref-output-flag. Default it non-nil, meaning Emacs will split the current frame in order to show the output buffer; setting it to nil means Emacs will show the output buffer at full frame. You can either set it from the customization buffer, or manually in your .emacs like this: (setq refdb-split-for-getref-output-flag nil) QUESTION: Should I make the default value in the code non-nil instead? Separate buffer for RefDB messages ---------------------------------- stderr from refdbc now goes to a separate *refdb-messages* buffer, instead of getting mixed with output. I've added a "Show RefDB Message Log" menu and refdb-show-messages command you can use to see that. Commands -------- Command equivalents for all menu items are now available. refdb-addref-on-region refdb-getref-by-author refdb-getref-by-title refdb-getref-by-keyword refdb-getref-by-id refdb-getref-by-citekey refdb-getref-by-advanced-search refdb-select-output-type refdb-select-database refdb-show-messages I guess we should maybe discuss coming up with a set of key bindings. I've also added a little more code to have Emacs emit more messages about what it's doing; e.g., (message "Adding references in selected region to %s database..." refdb-database) (message (format "Getting datasets for author %s ..." author)) etc. I made a lot of changes, so it might have broken some things. Please try and let me know. Next up, I'll probably be trying out the data caching and completion stuff I mentioned, and then on from there to dealing with processing docs/generating output. --Mike |
From: Bruce D'A. <bd...@fa...> - 2003-12-12 12:52:12
|
Looking really nice Mike! I wonder: is there an appropriate mode to get better display of the "screen" output? Also, could this later be configurable? > - for HTML or DocBook SGML, sgml-mode (psgml) Bruce |
From: Michael S. <sm...@xm...> - 2003-12-13 11:16:29
|
Bruce D'Arcus <bd...@fa...> writes: > Looking really nice Mike! > > I wonder: is there an appropriate mode to get better display of the > "screen" output? Nothing I know of, unless Markus has ideas. Actually, I wonder whether the default in Emacs should be something other than the "screen" output -- maybe RIS? We'd be distributing the refdb-mode.el package along with the ris.el package anyway, and to my eyes at least, that package give a nice, readable, syntax-highlighted view of the data. But that is all said without having much insight in the use cases for the various output types for the data. I guess I can see the advantages of the 'screen' format when you're looking at the data in a shell, but what's the value of viewing it that way in Emacs? Just the brevity? > Also, could this later be configurable? > > > - for HTML or DocBook SGML, sgml-mode (psgml) Yes, I was just being lazy there. I can add config options to allow you to specify which modes you prefer for XML and SGML and HTML output. But let me know what modes you have in mind. These days, I only work with XML and XHTML myself, and only use nXML, but I know other people need to work with SGML and psgml, and maybe with other HTML modes. --Mike |
From: Markus H. <mar...@mh...> - 2003-12-13 21:15:49
|
Michael Smith writes: > Actually, I wonder whether the default in Emacs should be something > other than the "screen" output -- maybe RIS? We'd be distributing the > refdb-mode.el package along with the ris.el package anyway, and to my > eyes at least, that package give a nice, readable, syntax-highlighted > view of the data. > As always, there won't be a real consensus on this. Could this be made user-configurable? > But that is all said without having much insight in the use cases for > the various output types for the data. I guess I can see the advantages > of the 'screen' format when you're looking at the data in a shell, but > what's the value of viewing it that way in Emacs? Just the brevity? > The screen output was indeed designed for viewing the results in an xterm. regards, Markus -- Markus Hoenicka mar...@ca... (Spam-protected email: replace the quadrupeds with "mhoenicka") http://www.mhoenicka.de |
From: Bruce D'A. <bd...@fa...> - 2003-12-13 22:38:24
|
On Dec 13, 2003, at 4:05 PM, Markus Hoenicka wrote: >> But that is all said without having much insight in the use cases for >> the various output types for the data. I guess I can see the >> advantages >> of the 'screen' format when you're looking at the data in a shell, but >> what's the value of viewing it that way in Emacs? Just the brevity? > > The screen output was indeed designed for viewing the results in an > xterm. Maybe you could add some code to ris.el to allow syntax highlighting of the screen output? Bruce |
From: Michael S. <sm...@xm...> - 2003-12-15 11:18:32
|
Hi Markus, You wrote: > Michael Smith writes: > > Actually, I wonder whether the default in Emacs should be something > > other than the "screen" output -- maybe RIS? We'd be distributing the > > refdb-mode.el package along with the ris.el package anyway, and to my > > eyes at least, that package give a nice, readable, syntax-highlighted > > view of the data. > > > > As always, there won't be a real consensus on this. Could this be made > user-configurable? It is now, by setting the refdb-output-type variable. What I meant was, the intial value for it in the defvar in the code is 'scrn. I was wondering if it should maybe be 'ris instead. Users could still configure it to have any initial value they want. It'd just be that, if they didn't configure it, it would default to 'ris instead of defaulting to 'scrn. --Mike |
From: Markus H. <mar...@mh...> - 2003-12-15 20:39:42
|
Michael Smith writes: > It is now, by setting the refdb-output-type variable. What I meant was, > the intial value for it in the defvar in the code is 'scrn. I was > wondering if it should maybe be 'ris instead. Users could still > configure it to have any initial value they want. It'd just be that, if > they didn't configure it, it would default to 'ris instead of defaulting > to 'scrn. > Ah, I see. If I find some time tonight I'll have a look at that marvellous w3 mode. If there's a trick to display a buffer containing a HTML document with that mode, we might consider using the HTML output as a pretty-printed version instead. But I've got no idea whether this is going to work. BTW I've tested 1.5 on the weekend real quick. It was entirely broke for me but I didn't have the time to investigate this yet. I'll be back with fixes or at least a complete problem description asap. regards, Markus -- Markus Hoenicka mar...@ca... (Spam-protected email: replace the quadrupeds with "mhoenicka") http://www.mhoenicka.de |
From: Michael S. <sm...@xm...> - 2003-12-15 21:27:52
|
Hi Markus, You wrote: > Michael Smith writes: > > It is now, by setting the refdb-output-type variable. What I meant was, > > the intial value for it in the defvar in the code is 'scrn. I was > > wondering if it should maybe be 'ris instead. Users could still > > configure it to have any initial value they want. It'd just be that, if > > they didn't configure it, it would default to 'ris instead of defaulting > > to 'scrn. > > > > Ah, I see. If I find some time tonight I'll have a look at that > marvellous w3 mode. If there's a trick to display a buffer containing > a HTML document with that mode, we might consider using the HTML > output as a pretty-printed version instead. But I've got no idea > whether this is going to work. Well, we're not actually limited to using w3 mode. The code can write the HTML output to a temp file, and then just have Emacs call browse-url on that, which will in turn call whatever browser the user has selected as his or her preferred browser. I think users would probably prefer that rather than having it hard-coded to display in w3 mode. The code wouldn't need to know or care what their preferred browser is -- for users who had their preferred browser set to w3, it'd send it to w3. Otherwise, whatever else they had selected. I have my own Emacs set up to call Mozilla. > BTW I've tested 1.5 on the weekend real quick. It was entirely broke > for me but I didn't have the time to investigate this yet. I'll be > back with fixes or at least a complete problem description asap. OK -- thanks. Note that when I changed the name to "refdb-mode", I changed every single variable name as well. So if you still have any related config variables in your .emacs that you haven't updated to the new names yet, that may be part of the problem. --Mike |
From: Markus H. <mar...@mh...> - 2003-12-16 22:07:23
Attachments:
refdb-mode.el.patch
|
Hi Mike, Michael Smith writes: > > BTW I've tested 1.5 on the weekend real quick. It was entirely broke > > for me but I didn't have the time to investigate this yet. I'll be > > back with fixes or at least a complete problem description asap. > > OK -- thanks. Note that when I changed the name to "refdb-mode", I > changed every single variable name as well. So if you still have any > related config variables in your .emacs that you haven't updated to the > new names yet, that may be part of the problem. > I think I've figured it out. First of all, if I cut+paste the elisp source from your mails, the backslash ends up as a funny Japanese character. Updating from CVS fixes this problem. Next, there is a small typo ("ID"vs "id") that apparently screws up the ID queries, see the appended patch. Finally, if I use sqlite as a backend (as I did in my preliminary test yesterday), all queries for partial strings require a '%'. E.g. to find the author entry 'Walsh,N.', you'll either have to type the full string or use 'Walsh%'. However, the percent sign is interpreted by a format call before it is sent to refdbc, and Emacs complains about not getting enough arguments. Can you work around this issue? regards, Markus |
From: Michael S. <sm...@xm...> - 2003-12-17 01:36:16
|
Hi Markus, You wrote: > Hi Mike, > > Michael Smith writes: > > > BTW I've tested 1.5 on the weekend real quick. It was entirely broke > > > for me but I didn't have the time to investigate this yet. I'll be > > > back with fixes or at least a complete problem description asap. > > > > OK -- thanks. Note that when I changed the name to "refdb-mode", I > > changed every single variable name as well. So if you still have any > > related config variables in your .emacs that you haven't updated to the > > new names yet, that may be part of the problem. > > > > I think I've figured it out. First of all, if I cut+paste the elisp > source from your mails, the backslash ends up as a funny Japanese > character. Updating from CVS fixes this problem. I see -- I should have thought about that. The reason for that I have my mail program, mutt, set up for Japanese, and in Japanese encodings, the backlash character and Yen symbol are the same character. So when I type a backslash in mail messages -- I actually edit as temporary files vim, it shows up in vim as a Yen symbol. But if I then open that temp file in Emacs (or some other text editor), before I send it, it'l still show up as a real backslash. So I guess the problem is with what mutt does with those messages before I send it them. I think this is probably also the cause for some of the problems that Bruce has reported. Anyway, next time I need to send any code by e-mail, I'll tar it or compress it first so that mutt doesn't monkey with it. > Next, there is a small typo ("ID"vs "id") that apparently screws up > the ID queries, see the appended patch. Thanks > Finally, if I use sqlite as a backend (as I did in my preliminary test > yesterday), all queries for partial strings require a '%'. E.g. to > find the author entry 'Walsh,N.', you'll either have to type the full > string or use 'Walsh%'. However, the percent sign is interpreted > by a format call before it is sent to refdbc, and Emacs complains > about not getting enough arguments. Can you work around this issue? Yes, I'm sure I can. I'll get it figured out asap and update the source in CVS today. --Mike |
From: Bruce D'A. <bd...@fa...> - 2003-12-17 20:06:19
|
On Dec 16, 2003, at 8:36 PM, Michael Smith wrote: > So when I type a backslash in mail messages -- I actually edit as > temporary files vim, it shows up in vim as a Yen symbol. But if I then > open that temp file in Emacs (or some other text editor), before I send > it, it'l still show up as a real backslash. So I guess the problem is > with what mutt does with those messages before I send it them. Curious question: why vim? Also, do you ever use vip-mode in emacs? Bruce |
From: Michael S. <sm...@xm...> - 2003-12-25 11:12:52
|
Bruce D'Arcus <bd...@fa...> writes: > On Dec 16, 2003, at 8:36 PM, Michael Smith wrote: > > >So when I type a backslash in mail messages -- I actually edit as > >temporary files vim, it shows up in vim as a Yen symbol. But if I then > >open that temp file in Emacs (or some other text editor), before I send > >it, it'l still show up as a real backslash. So I guess the problem is > >with what mutt does with those messages before I send it them. > > Curious question: why vim? mutt doesn't have a built-in editor -- it needs to call a separate editing app, and I've always had it set up to call vim. I guess I could probably set it up to use the console version of emacs, but I've never tried it. I used Emac Gnus for e-mail for quite a while, but switched back to vim some time ago. I can't remember why exactly, but I think I was having problems with getting Japanese encodings set up in Gnus. > Also, do you ever use vip-mode in emacs? I've never tried it. I sort of seems like the "worst of both worlds" to me :) At one time, I used an editor called "jed" that had an Emacs emulation mode but was much smaller and faster than Emacs. I think I was using it at the time because it had console color support and very good support for doing "folded" editing. --Mike |
From: Michael S. <sm...@xm...> - 2003-12-17 04:06:06
|
Hi Markus, You wrote: [...] > Finally, if I use sqlite as a backend (as I did in my preliminary test > yesterday), all queries for partial strings require a '%'. E.g. to > find the author entry 'Walsh,N.', you'll either have to type the full > string or use 'Walsh%'. However, the percent sign is interpreted > by a format call before it is sent to refdbc, and Emacs complains > about not getting enough arguments. Can you work around this issue? A workaround to try for now is just to specify two percent signs instead of one -- i.e., "%%" instead of "%". The double-percent-sign is the way of escaping it in Emacs so that the format and message functions don't try to expand it. --Mike |
From: Michael S. <sm...@xm...> - 2003-12-17 12:14:19
|
Markus Hoenicka <mar...@mh...> writes: [...] > Finally, if I use sqlite as a backend (as I did in my preliminary test > yesterday), all queries for partial strings require a '%'. E.g. to > find the author entry 'Walsh,N.', you'll either have to type the full > string or use 'Walsh%'. However, the percent sign is interpreted > by a format call before it is sent to refdbc, and Emacs complains > about not getting enough arguments. Can you work around this issue? I opened up bug #861419 for this http://sourceforge.net/tracker/index.php?func=detail&aid=861419&group_id=26091&atid=385991 And fixed it in v1.3. Please update your sandbox and let me know if it works as expected now. I'm only testing with the Postgres backend, and that supports full regex syntax instead of the SQL percent-sign stuff (as far as I can know), so I can't test myself whether queries with percent-signs work as expected. But I pretty sure that now that percent signs should be getting passed through to refdbc verbatim, without Emacs choking on them or munging them. --Mike |
From: Markus H. <mar...@mh...> - 2003-12-15 21:29:37
Attachments:
refdbw3.png
|
Markus Hoenicka writes: > Ah, I see. If I find some time tonight I'll have a look at that > marvellous w3 mode. If there's a trick to display a buffer containing > a HTML document with that mode, we might consider using the HTML > output as a pretty-printed version instead. But I've got no idea > whether this is going to work. > This apparently works. It uses the configured stylesheet and looks pretty cool on an X display, see attached image. regards, Markus |
From: Bruce D'A. <bd...@fa...> - 2003-12-12 14:04:00
|
Disregard request for customizing xml mode used for refdb output. I see my setup automatically uses nXML mode, which is all I wanted. Bruce |
From: Michael S. <sm...@xm...> - 2003-12-13 11:19:37
|
Bruce D'Arcus <bd...@fa...> writes: > > Disregard request for customizing xml mode used for refdb output. I > see my setup automatically uses nXML mode, which is all I wanted. Well, I can still see some value to making parts of that configurable. Yeah, for XML, it defaults to using nXML if you've got it installed, and to PSGML if you don't; but others might want it the other way around. --Mike |
From: Michael S. <sm...@xm...> - 2003-12-16 06:16:55
Attachments:
refdb-mode.el
|
Hi Markus, You wrote: [...] > BTW I've tested 1.5 on the weekend real quick. It was entirely broke > for me but I didn't have the time to investigate this yet. I'll be > back with fixes or at least a complete problem description asap. Please try with the latest CVS source (refdb-mode.el 1.2). I've tested that on Cygwin and Debian Linux with both Emacs 21 and 20, and it seems to be working fine. There was one minor bug in the output-buffer-choose-mode code in v1.1, but I've since checked in a fix for it. Anyway, if you try with the CVS source and it's still broke for you, definitely please let me know. --Mike |
From: Markus H. <mar...@mh...> - 2003-12-17 00:00:21
|
Hi Mike, ID queries work ok now, but there's still the issue with the SQL regexp character '%' which screws up a format call at some point. Otherwise queries work ok, and I can add references just fine. regards, Markus Michael Smith writes: > Anyway, if you try with the CVS source and it's still broke for you, > definitely please let me know. > -- Markus Hoenicka mar...@ca... (Spam-protected email: replace the quadrupeds with "mhoenicka") http://www.mhoenicka.de |