From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@newcastle.ac.uk (Phillip Lord) Newsgroups: gmane.emacs.help Subject: Re: automate command after saving Date: Thu, 19 Nov 2015 14:17:58 +0000 Message-ID: <87lh9u6pk9.fsf@newcastle.ac.uk> References: <87ziyamhx1.fsf@kaffanke.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1447942741 29653 80.91.229.3 (19 Nov 2015 14:19:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Nov 2015 14:19:01 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Martin Kaffanke Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 19 15:18:52 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZzQ2X-0003mm-5Z for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Nov 2015 15:18:21 +0100 Original-Received: from localhost ([::1]:41991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzQ2W-0007Nh-2S for geh-help-gnu-emacs@m.gmane.org; Thu, 19 Nov 2015 09:18:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzQ2H-0007NX-5n for help-gnu-emacs@gnu.org; Thu, 19 Nov 2015 09:18:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzQ2C-0008IK-6B for help-gnu-emacs@gnu.org; Thu, 19 Nov 2015 09:18:05 -0500 Original-Received: from cheviot22.ncl.ac.uk ([128.240.234.22]:36827) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzQ2B-0008I4-Vx for help-gnu-emacs@gnu.org; Thu, 19 Nov 2015 09:18:00 -0500 Original-Received: from smtpauth-vm.ncl.ac.uk ([10.8.233.129] helo=smtpauth.ncl.ac.uk) by cheviot22.ncl.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1ZzQ2B-0002oQ-D0; Thu, 19 Nov 2015 14:17:59 +0000 Original-Received: from jangai.ncl.ac.uk ([10.66.67.223] helo=localhost) by smtpauth.ncl.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1ZzQ2A-0003SC-Tl; Thu, 19 Nov 2015 14:17:58 +0000 In-Reply-To: <87ziyamhx1.fsf@kaffanke.at> (Martin Kaffanke's message of "Thu, 19 Nov 2015 10:56:26 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 128.240.234.22 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:108135 Archived-At: You could do this using after-save-hook. So, something like (add-hook 'after-save-hook 'pandoc-hook) (defun pandoc-hook() (compile "pandoc -t latex....")) Personally, I do this outside Emacs, though, with this little bash script. #!/bin/bash make $* while inotifywait -r -e MODIFY --exclude ".#*" --exclude ".*~" . do make $*; done; Cheap, cheerful but effective. Phil Martin Kaffanke writes: > Hi there, > > I'd like to run a command after saving, but just if I switch it on. > > Following scenario: > > When I write on an org file, before printing I look at the pdf version > created by > > pandoc -t latex -o filename-without-org-but-with.pdf filename.org > > And then I switch to emacs to do corrections. > > Now I'd like to automatically run pandoc again when I switch back to > evince (which automaticaly loads the pdf new when changed on disk). > > How could a make a switch for emacs to automatically run pandoc again > after C-x C-s? > > Thanks for your Ideas, > Martin -- Phillip Lord, Phone: +44 (0) 191 208 7827 Lecturer in Bioinformatics, Email: phillip.lord@newcastle.ac.uk School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord Room 914 Claremont Tower, skype: russet_apples Newcastle University, twitter: phillord NE1 7RU