Re: ;;; anything.el --- open anything
I use Wikipedia a lot, so I made a source similar to Google Suggest for Wikipedia titles. Here it is if someone's interested: (defvar anything-wikipedia-title-lookup-program nil The program is called with one argument and it should return matching titles from Wikipedia.) (setq anything-sources '(((name . Wikipedia Titles) (candidates . (lambda () (start-process wp-process nil anything-wikipedia-title-lookup-program (replace-regexp-in-string _ anything- pattern (candidate-transformer . (lambda (candidates) (mapcar (lambda (candidate) (replace-regexp-in-string _ candidate)) candidates))) (action . ((Look up Title . (lambda (candidate) (browse-url (concat http://en.wikipedia.org/wiki/; (url-hexify-string candidate))) (requires-pattern . 3) (delayed In order to get useful results exact title matches should be listed first and substring matches afterwards. Currently, anything.el cannot invoke two processes for the same source, one after the other, that's why you need to supply an external program for the lookup. It can be a simple shell script: grep -i ^$1$ title file grep -i $1 title file or a Windows batch file: @echo off grep.exe -i ^%1$ title file grep.exe -i %1 title file The current title file can be downloaded from here: http://download.wikimedia.org/enwiki/latest/enwiki-latest-all-titles-in-ns0.gz Enjoy. ___ gnu-emacs-sources mailing list gnu-emacs-sources@gnu.org http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources
Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs
Bill Clementson [EMAIL PROTECTED] writes: Hi Bill, Only the Macports install worked on my Powerbook G4 (and that took ages to build all the dependencies because Macports builds versions of the dependencies that work with the package you're installing even if you have non-Macports versions of the same progs installed and in your path). Tassilo, please forgive me for all the names I called you this afternoon for using git! ;-) Haha, forgiven. But, back to doc-view.el. Did I mention that it is way cool? :-) Thanks! There are a few ways that it could probably be made better though: 1. It is slow: It would probably be better to provide an async mode option. In other words, instead of waiting for the convert process to complete, let the user view the pages that have been generated and periodically, have doc-view automatically update the doc-view-current-files variable with the updated list of pages. I don't think that would help much. The generation of the pictures is about the last 5-10% of the transformation. 2. Cancel key: There should be a key binding to cancel the convert process and (optionally) view what has been generated so far. I've done that yesterday. Get the current version. 3. Page count: It would be useful to have a running update of how many pages have been converted so far in the minibuffer (or maybe the mode line so that the minibuffer isn't being continually updated and can be used for other commands). See my answer to point 1. 4. Batch mode: It would be nice to have an option to kick off a batch background process to do the conversion. For big documents, it isn't really practical to wait till it's been converted. Well, why do you think you have to wait? Go on with your work and eventually the *DocView* buffer pops up. (That's much better in the current version now.) 5. Dired key: It would be nice to have a defcustom value that would specify a dired map key that would call doc-view on a file (with a new doc-view function that doesn't prompt for the file name). This would make it easier to browse pdf files in dired. Good idea. I'll add that. Do you have a good suggestion what key could be used and is free? Did I mention that doc-view is way cool? :-) And think of how cool it will be in 5 or ten years when we all have 64-core 50 GHz computers with 512 GB RAM!!! Bye, Tassilo -- Scotty in Star Trek often says Ye cannae change the laws of physics. This is untrue. Chuck Norris can change the laws of physics. With his fists. ___ gnu-emacs-sources mailing list gnu-emacs-sources@gnu.org http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources
Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs
Hi Tassilo, Tassilo Horn [EMAIL PROTECTED] writes: Bill Clementson [EMAIL PROTECTED] writes: There are a few ways that it could probably be made better though: 1. It is slow: It would probably be better to provide an async mode option. In other words, instead of waiting for the convert process to complete, let the user view the pages that have been generated and periodically, have doc-view automatically update the doc-view-current-files variable with the updated list of pages. I don't think that would help much. The generation of the pictures is about the last 5-10% of the transformation. Darn. That's the major hassle with using doc-view and I thought having async functionality would make it less painful. 2. Cancel key: There should be a key binding to cancel the convert process and (optionally) view what has been generated so far. I've done that yesterday. Get the current version. Just did a git pull and it said I had the most up-to-date version already. I didn't see anything in the source - maybe you haven't checked it into your git repository yet? 3. Page count: It would be useful to have a running update of how many pages have been converted so far in the minibuffer (or maybe the mode line so that the minibuffer isn't being continually updated and can be used for other commands). See my answer to point 1. ok. 4. Batch mode: It would be nice to have an option to kick off a batch background process to do the conversion. For big documents, it isn't really practical to wait till it's been converted. Well, why do you think you have to wait? Go on with your work and eventually the *DocView* buffer pops up. (That's much better in the current version now.) The convert process seems very resource hungry as my Powerbook G4 slows to a crawl (and is basically unusable) when I'm converting a large (2MB) PDF file. On small PDF's, it's still usable (but slow). I thought that a batch option would provide an alternative that might not be as intrusive. 5. Dired key: It would be nice to have a defcustom value that would specify a dired map key that would call doc-view on a file (with a new doc-view function that doesn't prompt for the file name). This would make it easier to browse pdf files in dired. Good idea. I'll add that. Do you have a good suggestion what key could be used and is free? How about b (for browse) or V (for View)? Did I mention that doc-view is way cool? :-) And think of how cool it will be in 5 or ten years when we all have 64-core 50 GHz computers with 512 GB RAM!!! At the moment, I would be happy to just replace my Powerbook with a dual core computer with 4GB of RAM! - Bill ___ gnu-emacs-sources mailing list gnu-emacs-sources@gnu.org http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources
Re: doc-view.el --- View PDF/PostStript/DVI files in Emacs
Bill Clementson [EMAIL PROTECTED] writes: 5. Dired key: It would be nice to have a defcustom value that would specify a dired map key that would call doc-view on a file (with a new doc-view function that doesn't prompt for the file name). This would make it easier to browse pdf files in dired. Good idea. I'll add that. Do you have a good suggestion what key could be used and is free? How about b (for browse) or V (for View)? I think 'b' is available. However, you may find it useful to do what I did in my txutils.el package. I used defadvice around view-file (which is bound to v in dired). So, now if I hit v on a pdf, ps, doc, ppt html etc file, it converts the file to either text or html and then displays it in a buffer (in the case of html output and .html files, it just uses browse-url to display the rendered version). What I like about this approach is that I now always use 'v' to view a file and don't have to remember to hit a different key for different filetypes. HTH Tim -- tcross (at) rapttech dot com dot au ___ gnu-emacs-sources mailing list gnu-emacs-sources@gnu.org http://lists.gnu.org/mailman/listinfo/gnu-emacs-sources
smartquotes.el -- Insertion of unicode quotes in text documents
;;; Commentary ;; The functions provided by xmlunicode.el for the insertion of the fancy ;; unicode quotes (double and single) take into account the context of the ;; document for XML documents. Those quotes are more useful, in my experience, ;; in text files written in UTF-8 encoding, such as ReST syntax. The XML ;; functions from xmlunicode often do not work properly in text files, due to ;; the presence of the occasional or symbol. ;; Therefore, the smart insertion functions are difficult to use, because their ;; behavior is unpredictable. In accordance with The Humane Interface principles ;; (see J.Raskins' book), we provide context-independent versions of these ;; functions that are much easier to learn and use quickly, since their ;; behaviour is unambigous. ;;; Usage ;; To use the suggested bindings, insert this in your .emacs: ;;(require 'smartquotes) ;;(add-hook 'text-mode-hook 'text-mode-unicode-hook) ;; This does the following for text-mode bindings: ;; - C- inserts then cycles through the fancier double quotes; ;; - C-' inserts then cycles through the fancier single quotes; ;; - Inserting four dots inserts an ellipsis character. Inserting an additional ;; fourth dot resumes with a string of dots; ;; - Inserting four hyphens inserts an mdash (a long dash character), then an ;; ndash (an inter-word dash character), and then resumes with a string of ;; normal hyphens. ;;; smartquotes.el --- Insertion of unicode quotes in text documents -*- coding: utf-8 -*- ;; Copyright (C) 2007 Martin Blais ;; Inspired by xmlunicode.el, Copyright (C) 2003 Norman Walsh ;; Author: Martin Blais [EMAIL PROTECTED] ;; Maintainer: Martin Blais [EMAIL PROTECTED] ;; Created: 2007-08-26 ;; Version: 1.0 ;; Keywords: utf-8 unicode characters ;; This file is NOT part of GNU emacs. ;; This is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; This software is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary ;; The functions provided by xmlunicode.el for the insertion of the fancy ;; unicode quotes (double and single) take into account the context of the ;; document for XML documents. Those quotes are more useful, in my experience, ;; in text files written in UTF-8 encoding, such as ReST syntax. The XML ;; functions from xmlunicode often do not work properly in text files, due to ;; the presence of the occasional or symbol. ;; Therefore, the smart insertion functions are difficult to use, because their ;; behavior is unpredictable. In accordance with The Humane Interface principles ;; (see J.Raskins' book), we provide context-independent versions of these ;; functions that are much easier to learn and use quickly, since their ;; behaviour is unambigous. ;;; Usage ;; To use the suggested bindings, insert this in your .emacs: ;;(require 'smartquotes) ;;(add-hook 'text-mode-hook 'text-mode-unicode-hook) ;; This does the following for text-mode bindings: ;; - C- inserts then cycles through the fancier double quotes; ;; - C-' inserts then cycles through the fancier single quotes; ;; - Inserting four dots inserts an ellipsis character. Inserting an additional ;; fourth dot resumes with a string of dots; ;; - Inserting four hyphens inserts an mdash (a long dash character), then an ;; ndash (an inter-word dash character), and then resumes with a string of ;; normal hyphens. ;;; Changes ;;; Code: (defvar smartq-ldquo (decode-char 'ucs #x00201c)) (defvar smartq-rdquo (decode-char 'ucs #x00201d)) (defvar smartq-lsquo (decode-char 'ucs #x002018)) (defvar smartq-rsquo (decode-char 'ucs #x002019)) (defvar smartq-quot (decode-char 'ucs #x22)) (defvar smartq-apos (decode-char 'ucs #x27)) (defvar smartq-capos (decode-char 'ucs #x0002bc)) (defvar smartq-ndash (decode-char 'ucs #x002013)) (defvar smartq-mdash (decode-char 'ucs #x002014)) (defvar smartq-hellip (decode-char 'ucs #x002026)) (defun smartq-cycle-chars (charlist) Given that the last character is the given list, cycle the last char between the available characters in the list. ;; (let ((ch (char-before))) (let ((newch (cadr (memq (char-before) (append charlist (list (car charlist))) (if newch (progn (delete-backward-char 1) (insert newch)) (insert (car charlist) (defmacro smartq-cycle-fun (charlist) `(lambda () (interactive) (smartq-cycle-chars ,charlist))) (defvar