From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Jason Thomas Newsgroups: gmane.emacs.help Subject: elisp function that evaluates a line up to last character Date: Tue, 19 Mar 2019 13:15:44 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="69294"; mail-complaints-to="usenet@blaine.gmane.org" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 19 19:10:32 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h6JC3-000Ht0-DW for geh-help-gnu-emacs@m.gmane.org; Tue, 19 Mar 2019 19:10:31 +0100 Original-Received: from localhost ([127.0.0.1]:32985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6JC2-0004FG-6b for geh-help-gnu-emacs@m.gmane.org; Tue, 19 Mar 2019 14:10:30 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6ILH-0001vJ-V9 for help-gnu-emacs@gnu.org; Tue, 19 Mar 2019 13:16:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6ILG-0000TH-4b for help-gnu-emacs@gnu.org; Tue, 19 Mar 2019 13:15:59 -0400 Original-Received: from mail-vs1-xe44.google.com ([2607:f8b0:4864:20::e44]:44746) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h6ILF-0000QS-JX for help-gnu-emacs@gnu.org; Tue, 19 Mar 2019 13:15:58 -0400 Original-Received: by mail-vs1-xe44.google.com with SMTP id b8so12167764vsq.11 for ; Tue, 19 Mar 2019 10:15:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=Uimx0GTyZ2lWSd336d4X+70CaQyVS+WHxSJY4J900As=; b=Uaaxm862NVyuuYChAZbsjinq2gOFhSsbQQqZe0cz7p/iHPgx97xCBcc0yl2aAFmQbh me+Reb8b8TPvI7B9K18QIspLTAss5qHLsysPxR+ytNgTfRIlAlbGt4wkcPufpT4Sj4PG zXBQLJ93E6Y0pJE0pQxva27TAXssp1xHnu5EhsxRPj1ttTgJWQxjhFUObQOJRMgdPtcI E1snJ5Ym7OPAlz95S58s981RxaocoT1HLi5d6b833EOZr81PSSY2JbuLiu4w1PK+4uZP WSXgBYxOZVEZYA+mUTDfclVaEBzZRF5n5b9nRzTs0ja/9757yVKWM5P4aEO155wYpc94 HMgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Uimx0GTyZ2lWSd336d4X+70CaQyVS+WHxSJY4J900As=; b=CLweKFgXraOsN4MlfJQTblSVNcmR5uaH4zhCvuUXhKaJ/BC/AP+JQNMmgt1nnxGd3G fiJxfNpq258jFyzwohUCM+MrrY7swmG2JkyUpuBKbiZcs9HsUCXMMzJnpWli8ZI+6+4w s7cPkPQCtOPAdlxpxLqEHp5wx9qzfpjAFEezRpIZhOhHkPJoEi5fKaOF4GfwRYCWKNbi 6VxBYvZZa03LTiGU0sO9a5UPtIpRq4tm8E6UH8t6M+P6oThdRcs5PzXs1QBXNzapJhA5 7Vh6BQ8FqBUaEuC2iJx4bz3nsx/LbWO7Fx0iX3sBd4po+hMgKtayMmatT5HZOvLCND35 qhjw== X-Gm-Message-State: APjAAAU1B1SvjNt7SgX/tbaWbTgYDncF1O9GizMqbkiH3N54tCm1V6wV 520MsQoXSBEYXPtysDiS4ylGWLTzKz+SYNd28gKxRzln X-Google-Smtp-Source: APXvYqxo0P49hepgh89IK4qn8KnLLIAubrwI4s3koIdZd7VMjVJNf2IoiTgfkn/btcS94PtaPtvgOY4ml0rLAH2Amvk= X-Received: by 2002:a67:e30a:: with SMTP id j10mr2030116vsf.103.1553015755559; Tue, 19 Mar 2019 10:15:55 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::e44 X-Mailman-Approved-At: Tue, 19 Mar 2019 14:10:08 -0400 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:119679 Archived-At: Hello, I am trying to write a function that will (1) take a new region, defined by the first character in the current line (where the cursor is) and end the region at the penultimate character in the same line; and (2) pass this text to another function (called ess-eval-region). Basically, I am trying to evaluate some code that ends with a semi-colon, but I need to leave out the semi-colon (during evaluation). Here is what I have so far (at the end, I try to bind this function to and activate this binding in ess mode): (defun my-stata-eval-delim-line (&optional beg end) (interactive) (let ((beg (cond (beg beg) ((region-active-p) (region-beginning)) (t (line-beginning-position)))) (end (cond (end end) ((region-active-p) (copy-marker (region-end)) (backward-char)) (t (line-end-position))))) (ess-eval-region beg end))) (eval-after-load 'ess-stata-mode '(define-key ess-mode-map "" 'my-stata-eval-delim-line)) but I keep getting an error when I try to use the function on the following line: ds; "Wrong number of arguments: (3 . 5), 2" Any suggestions/hints about what I am doing wrong (I'm sure there is a long list) is greatly appreciated! Thanks in advance, Jason