All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xavier Maillard <xma@gnu.org>
To: Remi Vanicat <vanicat@debian.org>
Cc: vanicat@debian.org, davidk@lysator.liu.se, jnareb@gmail.com,
	julliard@winehq.org, git@vger.kernel.org
Subject: Re: [PATCH] git.el: Add a git-grep command
Date: Sun, 24 Feb 2008 03:00:01 +0100	[thread overview]
Message-ID: <200802240200.m1O201Rh015406@localhost.localdomain> (raw)
In-Reply-To: <8763wfwjg6.dlv@maison.homelinux.org> (message from Remi Vanicat on Sat, 23 Feb 2008 20:39:53 +0100)


   Xavier Maillard <xma@gnu.org> writes:

   > Hi,
   >
   >    Here is a modification with inclusion of git-grep only when the grep
   >    library is available. 
   >
   >    +(require 'grep () t)
   >
   >    +(when (featurep 'grep)
   >    +  (defvar git-grep-history nil)
   >    +
   >    +  (defun git-grep (regexp &optional files dir)
   >
   > Why not just do something like this ?
   >
   > (when (require 'grep () t)
   >       (defvar ...)
   >       (defun git-grep ...))

   Because I wanted require to stay on top of the file, but I didn't want
   to put the rest of the git-grep stuff there.

Good point. Though, you can still "embed" the require form
directly into the defun. This is thing I have already seen in the
past. Dunno if it is a convention or a coding style but something
like:

(defun git-grep ()
 "Docstring"
 (interactive)
 (when (require 'grep nil t)
       here the rest
  ))

is doable too. Maybe the if-else form would be better though with
an else clause to (error "No grep package foud.").

Well just kidding, your patch is okay ;)

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org

      parent reply	other threads:[~2008-02-24  2:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-19 13:03 [PATCH] git.el: Add a git-grep command David Kågedal
2008-02-21 13:12 ` Remi Vanicat
2008-02-21 14:55   ` David Kågedal
2008-02-22  2:00 ` Xavier Maillard
2008-02-22  7:31 ` Karl Hasselström
2008-02-22  9:15   ` David Kågedal
2008-02-22 11:55     ` Karl Hasselström
2008-02-22  9:03 ` Jakub Narebski
2008-02-22  9:18   ` David Kågedal
2008-02-22 10:21     ` Jakub Narebski
2008-02-22 10:44       ` David Kågedal
2008-02-22 11:11         ` Remi Vanicat
2008-02-22 11:43           ` David Kågedal
2008-02-23  2:00           ` Xavier Maillard
2008-02-23 19:39             ` Remi Vanicat
2008-02-23 22:41               ` Xavier Maillard
2008-02-24  2:00               ` Xavier Maillard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200802240200.m1O201Rh015406@localhost.localdomain \
    --to=xma@gnu.org \
    --cc=davidk@lysator.liu.se \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=julliard@winehq.org \
    --cc=vanicat@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.