From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: How to create a function to italicize in latex in emacs? Date: Wed, 27 Jul 2011 21:50:56 +0200 Message-ID: <4E306C20.9010804@easy-emacs.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1311796276 26269 80.91.229.12 (27 Jul 2011 19:51:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 27 Jul 2011 19:51:16 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 27 21:51:12 2011 Return-path: Envelope-to: geh-help-gnu-emacs@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 1QmA8N-0001ux-9N for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Jul 2011 21:51:11 +0200 Original-Received: from localhost ([::1]:47695 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmA8M-0005CS-Vh for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Jul 2011 15:51:10 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:44498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmA8I-0005C6-46 for help-gnu-emacs@gnu.org; Wed, 27 Jul 2011 15:51:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QmA8D-0004Ox-3o for help-gnu-emacs@gnu.org; Wed, 27 Jul 2011 15:51:06 -0400 Original-Received: from moutng.kundenserver.de ([212.227.17.8]:62501) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmA8C-0004OW-L4 for help-gnu-emacs@gnu.org; Wed, 27 Jul 2011 15:51:01 -0400 Original-Received: from [192.168.178.27] (brln-4dbc767f.pool.mediaWays.net [77.188.118.127]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0Me5K2-1R39KA2a7i-00PXW1; Wed, 27 Jul 2011 21:50:57 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.2.18) Gecko/20110616 SUSE/3.1.11 Thunderbird/3.1.11 In-Reply-To: X-Provags-ID: V02:K0:mPWA8ELhzcsfSfd5cgxzhR1Cu1UORFiP/n6SV6hKenV ywZd8tTrHR0+D+VcGaR2cwWxkDe9APPramuUmtU9FTvb1hnkfV zM9ste/zP+9hiM3OHbOgZiJNAogq83TdEWf6D8R2BhYEqh123y /08wqJn1tS36lW3z6ACsUWyEvCpNCSybuibhbqKOoZA4mXkek6 LC0FFRdEntd5EYzYuao1fyh3EbA6rFz/dnTv6Uhs3U= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.227.17.8 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:81815 Archived-At: Am 26.07.2011 12:58, schrieb Pedro Costa: > Hi, > > I would like to italicize a word in latex in emacs automatically. > Instead of write \textit{word}, I would like to select the "word" and > then write M-x and it's added textit around the word. Do > I have to create a lisp function in .emacs? How do I do that? > > Thanks, > > Hi, running the code below you need a package thing-at-point-utils.el from http://launchpad.net/s-x-emacs-werkstatt/thing-at-point-utils/1.2/+download/thing-at-point-utils-1.2.tgz otherwise replace (ar-bounds-of-word-atpt) by a function delivering the borders of the word, a cons (defun textit () (interactive "*") (let* ((bounds (ar-bounds-of-word-atpt)) (beg (car bounds)) (end (copy-marker (cdr bounds)))) (goto-char beg) (insert "\\textit{") (goto-char end) (insert "}"))) HTH, Andreas -- https://launchpad.net/python-mode https://launchpad.net/s-x-emacs-werkstatt/