From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Incorrect indentation after :name Date: Mon, 04 Jul 2005 10:48:54 -0400 Message-ID: References: <42C80B48.3080103@student.lu.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1120489709 18245 80.91.229.2 (4 Jul 2005 15:08:29 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 4 Jul 2005 15:08:29 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 04 17:08:20 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DpSXL-0006d5-62 for ged-emacs-devel@m.gmane.org; Mon, 04 Jul 2005 17:07:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DpSYX-0003d5-WC for ged-emacs-devel@m.gmane.org; Mon, 04 Jul 2005 11:08:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DpSWS-0002vN-4w for emacs-devel@gnu.org; Mon, 04 Jul 2005 11:06:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DpSWM-0002tG-HC for emacs-devel@gnu.org; Mon, 04 Jul 2005 11:06:07 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DpSWM-0002le-7e for emacs-devel@gnu.org; Mon, 04 Jul 2005 11:06:06 -0400 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DpSLc-0003Qf-OS for emacs-devel@gnu.org; Mon, 04 Jul 2005 10:55:01 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 5E2E22CF54E; Mon, 4 Jul 2005 10:49:00 -0400 (EDT) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id A6B354AC010; Mon, 4 Jul 2005 10:48:54 -0400 (EDT) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id 8785CE6C1B; Mon, 4 Jul 2005 10:48:54 -0400 (EDT) Original-To: Lennart Borgman In-Reply-To: <42C80B48.3080103@student.lu.se> (Lennart Borgman's message of "Sun, 03 Jul 2005 17:59:04 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-4.847, requis 5, autolearn=not spam, AWL 0.05, BAYES_00 -4.90) X-MailScanner-From: monnier@iro.umontreal.ca X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:40334 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:40334 >>>>> "Lennart" == Lennart Borgman writes: > This gets incorrectly indented after :background. > (put-text-property 0 (length s) > 'face '(:background "red" > :foreground "black" > :height 1.5) s) I've been using the patch below for several years now quite happily. If people like it, I'll glad it install it, Stefan --- orig/lisp/emacs-lisp/lisp-mode.el +++ mod/lisp/emacs-lisp/lisp-mode.el @@ -895,12 +887,18 @@ (let ((normal-indent (current-column))) (goto-char (1+ (elt state 1))) (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t) - (if (and (elt state 2) - (not (looking-at "\\sw\\|\\s_"))) - ;; car of form doesn't seem to be a symbol - (progn - (if (not (> (save-excursion (forward-line 1) (point)) - calculate-lisp-indent-last-sexp)) + (let ((function (and (or (not (elt state 2)) + (looking-at "\\(\\sw\\|\\s_\\)+")) + (match-string 0)))) + (if (or (not function) + (and (> (point) (1+ (point-min))) + (or (save-excursion (backward-char 2) (looking-at "'(")) + (keywordp (intern-soft function))) + (not (fboundp (intern-soft function))))) + ;; car of form doesn't seem to be a function + (progn + (if (not (> (save-excursion (forward-line 1) (point)) + calculate-lisp-indent-last-sexp)) (progn (goto-char calculate-lisp-indent-last-sexp) (beginning-of-line) (parse-partial-sexp (point)