From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Camm Maguire Newsgroups: gmane.emacs.devel Subject: Re: Djvu mode Date: Sun, 02 Oct 2011 00:22:29 -0400 Message-ID: <878vp49g56.fsf@maguirefamily.org> References: <871uv17nar.fsf@gmail.com> <874nzwvjgi.fsf@maguirefamily.org> <82bou4y5kz.fsf@gmail.com> <87d3ejtjrb.fsf_-_@niu.edu> <87r52zl29j.fsf_-_@maguirefamily.org> <20100.46983.768447.889306@gargle.gargle.HOWL> <87d3ejgmmz.fsf@maguirefamily.org> <20103.17789.10053.53615@gargle.gargle.HOWL> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1317657725 1712 80.91.229.12 (3 Oct 2011 16:02:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 3 Oct 2011 16:02:05 +0000 (UTC) To: "Roland Winkler" ,joakim@verona.se,emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 03 18:02:01 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RAkxs-0004ot-FC for ged-emacs-devel@m.gmane.org; Mon, 03 Oct 2011 18:02:00 +0200 Original-Received: from localhost ([::1]:42743 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAkxq-0001DM-V4 for ged-emacs-devel@m.gmane.org; Mon, 03 Oct 2011 12:01:58 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:58345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAkxj-0001BZ-Ll for emacs-devel@gnu.org; Mon, 03 Oct 2011 12:01:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RAkxi-00059i-FZ for emacs-devel@gnu.org; Mon, 03 Oct 2011 12:01:51 -0400 Original-Received: from tvwna-ip-a-22.princeton.org ([66.180.184.32]:34111 helo=localhost.m.enhanced.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RAkxg-00059A-FT; Mon, 03 Oct 2011 12:01:48 -0400 Original-Received: from camm by localhost.m.enhanced.com with local (Exim 4.69) (envelope-from ) id 1RADZN-0004LD-J0; Sun, 02 Oct 2011 00:22:29 -0400 In-Reply-To: <20103.17789.10053.53615@gargle.gargle.HOWL> (Roland Winkler's message of "Sat\, 1 Oct 2011 11\:53\:17 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 66.180.184.32 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:144544 Archived-At: Greetings! "Roland Winkler" writes: > On Thu Sep 29 2011 Camm Maguire wrote: >> ... or just remove the -u from the code, your text will have a few >> control codes, but you should still be able to get the idea. > > Thanks, this works. > >> There are two highlighting modes, one by just dragging mouse-1 over >> any rectangle, which allows selection of text or an underlying image >> such as a graph (see "q" and "i"), and one anchored to the text, >> whereby if you click on the image of word 1, which appears in the >> minibuffer, and then on word 2, which does likewise, you can do "h" to >> highlight that region. Dragging mouse-3 removes any overlapping >> highlighted region. > > What kind of highlighting are you talking about: highlighting that > is just visible while the document is displayed? Or highlighting via > the maparea annotation syntax that is permanently stored in the djvu > document? -- With your code, when I view a djvu document that Both, but see below. > already contains maparea annotations the respective areas are not > highlighted in emacs. > Currently the code ignores but preserves non-djvm-mode produced annotations, but this should be easy to add. For example, drag a box with mouse-1, then type 'k' (for "keep"), then 's' for save. The highlighted rectangle is now permanent. Dragging with mouse-3 over an overlapping box removes the highlight, and then 's' will eliminate it from the file. Or mouse-1 on a word, which should appear in the minibuffer blow, then another, then type 'h' for highlight, then 'k' and 's'. This allows highlighting anchored on word boundaries. In either case, 'q' gives the text in the most recent highlighted box by default, but with a prefix 'q' allows mouse-1 to select a different region. 'i' works the same for an extracted sub-image. You can mouse-1 on a word, then hit 'e' and see the text layer in lisp with the point at the word in question. You can edit, then save to the file with C-cC-c. 'c' prompts for mouse-1 to select a highlighted region, and then another mouse-1 to select a text box note location, then creates a buffer for you to add any text note at that spot in the document. The new box appears as a pushpin note in djview. 'w' highlights words by regexp, adding to a list until cleared by 'w' with a prefix. 'r' does reverse illumination. 'n' and 'p' advance and turn back pages, taking an argument for the number to skip. M-g g advances to a given page as elsewhere in emacs. '+'/'-' enlarges or shrinks the image. C-cC-c toggles to a flat text representation of the text layer, built from the file rather than djvused as the latter does not consistently place page feed control codes. These are needed to sync the text and image pages. So navigating either in text or image, and then C-cC-c gives you the image or text on the same page. Thus isearch works on images too. > On the other hand adding these maparea annotations to a djvu > document is really one of the things I wanted to achieve with my > code. I am currently using djview for viewing the final result as it Me too. This is the main point. I am currently using it for this with success. I'm not really sure though whether text notes are best placed in the file, as you have to click on the box to see them (in emacs djvm mode or djview), or whether org-mode should be used for notes on the document. I can describe the attached org-mode support if you are interested. I seem to prefer this at the moment. > nicely displays these annotations including any text layers they > might have. Emacs with this mode does too, but just for the annotations it writes itself at the moment. It labels these with a "djvm" comment. > > Also, with your code I am a bit surprised that when I search a text > string, the highlighting produced by emacs is not properly aligned > with the underlying picture which is somewhat annoying. > This is a somewhat common indication of a poorly constructed text layer by an early ocr engine. I've always cleared this by a fresh ocrodjvu --in-place foo.djvu. Boxes then line up perfectly. I think the ocr code has only very recently matured. Take care, > Roland > > > > -- Camm Maguire camm@maguirefamily.org ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah