From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Whitfield Diffie Newsgroups: gmane.emacs.help Subject: Line editor with dynamic prompt Date: Tue, 28 Oct 2014 09:15:49 -0700 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=bcaec548a485ea635205067df5ed X-Trace: ger.gmane.org 1414512986 14661 80.91.229.3 (28 Oct 2014 16:16:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 Oct 2014 16:16:26 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 28 17:16:16 2014 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 1Xj9RP-0004Zs-KO for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Oct 2014 17:16:15 +0100 Original-Received: from localhost ([::1]:40232 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xj9RP-0004BL-62 for geh-help-gnu-emacs@m.gmane.org; Tue, 28 Oct 2014 12:16:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xj9R1-00042T-RN for help-gnu-emacs@gnu.org; Tue, 28 Oct 2014 12:15:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xj9R1-0000Vp-49 for help-gnu-emacs@gnu.org; Tue, 28 Oct 2014 12:15:51 -0400 Original-Received: from mail-vc0-x233.google.com ([2607:f8b0:400c:c03::233]:55994) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xj9R0-0000Va-UU for help-gnu-emacs@gnu.org; Tue, 28 Oct 2014 12:15:51 -0400 Original-Received: by mail-vc0-f179.google.com with SMTP id ij19so536546vcb.38 for ; Tue, 28 Oct 2014 09:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=P1bA3MgR5xAduPBrHzilwriZwwyzeeZNaOjpisF/hcA=; b=OIU+WgJtqR8ZTDL9xtXwpBMfuPsgMruSmQKtMFDMAqo2U+RGlTQwtTHDzWgFXQ/+2f vVtmFeixU5eJ5Sj3EWcuFyXvb04I5cJaP6vt2km0bbKvC9rqIHQ8NJX2ZvL/CfHdAAJ7 pwqdxztcXgClvyHsJ04Z7y5K/WdQK67C59JeIHLFwUiEmt+fP8PRIqf/JZg7zl+hAjFn aPW7dXHbdLOgGBPSyRg/RC6UQMwbqWY6g0H3Ui6racC19mTUMZIfB7q0CRt0axvq67rJ Rwss0h7VCZhgnX/BtMnUdo8l3QWjbsY8xIVkQV6XkKGdK+0RDreEj9eOR94BBIA5IzT0 jUVA== X-Received: by 10.52.111.33 with SMTP id if1mr915991vdb.47.1414512950002; Tue, 28 Oct 2014 09:15:50 -0700 (PDT) Original-Received: by 10.31.8.129 with HTTP; Tue, 28 Oct 2014 09:15:49 -0700 (PDT) X-Google-Sender-Auth: PKWL8xD8ZxOmVpItc_B3HnVd_40 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400c:c03::233 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:100634 Archived-At: --bcaec548a485ea635205067df5ed Content-Type: text/plain; charset=ISO-8859-1 The attached program --- whose calling sequence is (lineedit prompt-base starting-string position-in-string) displays the length of the string and the position of point in the string as part of the prompt; it changes as point moves or the string is edited. Does anyone know how to do this without having to write the line editor by hand? Whit --bcaec548a485ea635205067df5ed Content-Type: application/octet-stream; name="lineedit.el" Content-Disposition: attachment; filename="lineedit.el" Content-Transfer-Encoding: base64 X-Attachment-Id: f_i1tgderf0 KGRlZnVuIGxpbmVlZGl0IChwcm9tcHQgJm9wdGlvbmFsIGRlZmF1bHQgcG9zaXRpb24pCgogICIg ICBMaW5lZWRpdCByZWFkcyBhIGxpbmUgb2YgdGV4dCwgcHJvbXB0aW5nIHdpdGggYGBDaGFyOiAn Jy4gIEVjaG8gZWFjaAogICBjaGFyYWN0ZXIgdHlwZWQuICBJbnNlcnQgfCBhcyB0aGUgY3Vyc29y LiAgRW5kIHdpdGggUkVULCBMRkQsIG9yIEVTQy4gIERFTAogICBhbmQgQy1oIHJ1YiBvdXQuICBD LXUga2lsbHMgdGhlIGxpbmUuIgoKICAobGV0ICgoY3Vyc29yLWluLWVjaG8tYXJlYSBuaWwpIChs aW5lIChvciBkZWZhdWx0ICIiKSkKCShwb3NpdGlvbiAob3IgcG9zaXRpb24gKGlmIGRlZmF1bHQg KGxlbmd0aCBkZWZhdWx0KSAwKSkpIGNoYXIpCiAgICAod2hpbGUgKHByb2duIChtZXNzYWdlICIl cyVzICVzIgoJCQkgICBwcm9tcHQKCQkJICAgKGNvbmNhdCAoaWYgKDwgcG9zaXRpb24gMTApICIg IiAiIikKCQkJCSAgIChpZiAoPCAobGVuZ3RoIGxpbmUpIDEwKSAiICIgIiIpCgkJCQkgICAiKCIg KHByaW4xLXRvLXN0cmluZyBwb3NpdGlvbikgIi8iCgkJCQkgICAocHJpbjEtdG8tc3RyaW5nIChs ZW5ndGggbGluZSkpICIpIikKCQkJICAgKGxldCAoKGV4aGliaXQgKGNvbmNhdCBsaW5lICIgIikp KQoJCQkgICAgIChwdXQtdGV4dC1wcm9wZXJ0eSAwIChsZW5ndGggZXho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SAgICAgICAgICAgIDs7IGJlZ2lubmluZyBvZiBsaW5lCgkgICAgKCg9 IGNoYXIgPwIpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDs7IGJhY2t3YXJkIGNoYXIK CSAgICAgKHdoZW4gKD4gcG9zaXRpb24gMCkgKHNldHEgcG9zaXRpb24gKDEtIHBvc2l0aW9uKSkp KQoJICAgICgoPSBjaGFyID8EKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA7OyBkZWxl dGUgY2hhcgoJICAgICAod2hlbiAoPCBwb3NpdGlvbiAobGVuZ3RoIGxpbmUpKQoJICAgICAgIChs ZXQgKChuZXctbGluZSAoY29uY2F0IChzdWJzdHJpbmcgbGluZSAwIHBvc2l0aW9uKQoJCQkJICAg ICAgIChzdWJzdHJpbmcgbGluZSAobWluIChsZW5ndGggbGluZSkKCQkJCQkJCSAgICAoMSsgcG9z aXRpb24pKSkpKSkKCQkgKGFuZCAoYXJyYXlwIGxpbmUpIChmaWxsYXJyYXkgbGluZSA/XDApKQoJ CSAoc2V0cSBsaW5lIG5ldy1saW5lKSkpKQoJICAgICgoPSBjaGFyID9cQy10KQoJICAgICAod2hl biAoYW5kICg+IHBvc2l0aW9uIDApICg8IHBvc2l0aW9uIChsZW5ndGggbGluZSkpKQoJICAgICAg IChsZXQqICgoaW5pdGlhbCAoc3Vic3RyaW5nIGxpbmUgMCAoMS0gcG9zaXRpb24pKSkKCQkgICAg ICAobGNoYXIgKHN1YnN0cmluZyBsaW5lICgxLSBwb3NpdGlvbikgcG9zaXRpb24pKQoJCSAgICAg IChyY2hhciAoc3Vic3RyaW5nIGxpbmUgcG9zaXRpb24gKDErIHBvc2l0aW9uKSkpCgkJICAgICAg KGZpbmFsIChzdWJzdHJpbmcgbGluZSAoMSsgcG9zaXRpb24pKSkKCQkgICAgICAobmV3LWxpbmUg KGNvbmNhdCBpbml0aWFsIHJjaGFyIGxjaGFyIGZpbmFsKSkpCgkJIChhbmQgKGFycmF5cCBsaW5l KSAoZmlsbGFycmF5IGxpbmUgP1wwKSkKCQkgKHNldHEgbGluZSBuZXctbGluZSkKCQkgKGluY3Ig cG9zaXRpb24pKSkpCgkgICAgKCg9IGNoYXIgPwUpICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIDs7IGVuZCBvZiBsaW5lCgkgICAgIChzZXRxIHBvc2l0aW9uIChsZW5ndGggbGluZSkpKQoJ ICAgICgoPSBjaGFyID8GKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA7OyBmb3J3YXJk IGNoYXIKCSAgICAgKHdoZW4gKDwgcG9zaXRpb24gKGxlbmd0aCBsaW5lKSkKCSAgICAgICAoc2V0 cSBwb3NpdGlvbiAoMSsgcG9zaXRpb24pKSkpCgkgICAgKCg9IGNoYXIgPwspICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIDs7IGtpbGwgcmVzdCBvZiBsaW5lCgkgICAgIChzZXRxIGxpbmUg KHN1YnN0cmluZyBsaW5lIDAgcG9zaXRpb24pKSkKCSAgICAKCSAgICAodCAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIDs7IGluc2VydCBjaGFyCgkgICAgIChsZXQqICgo bmV3LWNoYXIgKGNoYXItdG8tc3RyaW5nIGNoYXIpKQoJCSAgICAgIChuZXctbGluZSAoY29uY2F0 IChzdWJzdHJpbmcgbGluZSAwIHBvc2l0aW9uKQoJCQkJCW5ldy1jaGFyCgkJCQkJKHN1YnN0cmlu ZyBsaW5lCgkJCQkJCSAgIHBvc2l0aW9uCgkJCQkJCSAgIChsZW5ndGggbGluZSkpKSkpCgkJIChh bmQgKGFycmF5cCBsaW5lKSAoZmlsbGFycmF5IGxpbmUgP1wwKSkKCQkgKGZpbGxhcnJheSBuZXct Y2hhciA/XDApCgkJIChzZXRxIGNoYXIgP1wwKQoJCSAoc2V0cSBwb3NpdGlvbiAoMSsgcG9zaXRp b24pKQoJCSAoc2V0cSBsaW5lIG5ldy1saW5lKSkpKSkKICAgIChtZXNzYWdlIG5pbCkKICAgICht ZXNzYWdlICIlcyIgbGluZSkpKQoKCg== --bcaec548a485ea635205067df5ed--