Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / ac / 6505f2b7eefaffb24d63dabb77bcc9544e2a43
1 Return-Path: <jani@nikula.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 8E0FE431FBF\r
6         for <notmuch@notmuchmail.org>; Sun, 22 Mar 2015 13:14:15 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 1.738\r
10 X-Spam-Level: *\r
11 X-Spam-Status: No, score=1.738 tagged_above=-999 required=5\r
12         tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_LOW=-0.7]\r
13         autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id puO0+LDqRKhM for <notmuch@notmuchmail.org>;\r
17         Sun, 22 Mar 2015 13:14:12 -0700 (PDT)\r
18 Received: from mail-we0-f178.google.com (mail-we0-f178.google.com\r
19         [74.125.82.178]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 2CAF6431FBC\r
22         for <notmuch@notmuchmail.org>; Sun, 22 Mar 2015 13:14:11 -0700 (PDT)\r
23 Received: by webee49 with SMTP id ee49so12857002web.2\r
24         for <notmuch@notmuchmail.org>; Sun, 22 Mar 2015 13:14:10 -0700 (PDT)\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26         d=1e100.net; s=20130820;\r
27         h=x-gm-message-state:from:to:cc:subject:date:message-id;\r
28         bh=oAboX8COGcDdCna+9MXMvbW1nNZWWeNtyrOwhvZ10W4=;\r
29         b=XyP+UtK9wc3EKJw13xZqBXuuu97+g+sqiDl43n40ncphkRsODeWBxoiNyf19Nf2Wqs\r
30         hfCeVqHByomEM+7660k3gLksIJ8YJ6okOQs07baFT0Fu+nwOpCAQEU8lWLu5zzUjEr+X\r
31         83xD9dHcJXtgreIKZWHhcpeQNqLD5L3TNQv3s9tfmkHRNulHtuq63N/jWEEnbgJBRnM6\r
32         gjcuugXg73O+kfQTU9g37fT1GnwzkjW9fKtJMIHow30DLRQAE8tUUf/bzPKDG9CVQiK+\r
33         8G0tau3Hqk4g7YGbZL3w9W9JO12SRg/nutcWF2cIDbfiVFKoB1GbtMUbPM9Nw+i/1Q1R\r
34         n/rw==\r
35 X-Gm-Message-State:\r
36  ALoCoQkjuGS+Lo46FFSzEQU6J65+hDezf+s6HBC5jQNm7Cx4f9CpCXccoUyZL1YCguyZbx+Xu1xY\r
37 X-Received: by 10.180.207.227 with SMTP id lz3mr13430518wic.47.1427055250708; \r
38         Sun, 22 Mar 2015 13:14:10 -0700 (PDT)\r
39 Received: from localhost (mobile-internet-bcee3b-76.dhcp.inet.fi.\r
40         [188.238.59.76])\r
41         by mx.google.com with ESMTPSA id o10sm4295654wiy.18.2015.03.22.13.14.09\r
42         (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
43         Sun, 22 Mar 2015 13:14:09 -0700 (PDT)\r
44 From: Jani Nikula <jani@nikula.org>\r
45 To: notmuch@notmuchmail.org\r
46 Subject: [PATCH] notmuch-emacs-mua: do not create a frame by default with\r
47         --client\r
48 Date: Sun, 22 Mar 2015 22:14:29 +0200\r
49 Message-Id: <1427055269-4742-1-git-send-email-jani@nikula.org>\r
50 X-Mailer: git-send-email 2.1.4\r
51 X-BeenThere: notmuch@notmuchmail.org\r
52 X-Mailman-Version: 2.1.13\r
53 Precedence: list\r
54 List-Id: "Use and development of the notmuch mail system."\r
55         <notmuch.notmuchmail.org>\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
59 List-Post: <mailto:notmuch@notmuchmail.org>\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
63 X-List-Received-Date: Sun, 22 Mar 2015 20:14:15 -0000\r
64 \r
65 Make the default behaviour for --client the same as emacsclient\r
66 default: do not create a new frame. Add a new option --create-frame,\r
67 passing the same option to emacsclient to create a frame.\r
68 \r
69 ---\r
70 \r
71 With this, 'notmuch-emacs-mua --client' does what I want, which was\r
72 not possible with any combination of options before. Please see if you\r
73 can still do what you want!\r
74 ---\r
75  doc/man1/notmuch-emacs-mua.rst | 14 +++++++++-----\r
76  notmuch-emacs-mua              | 29 ++++++++++++++++++++---------\r
77  2 files changed, 29 insertions(+), 14 deletions(-)\r
78 \r
79 diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst\r
80 index 36b51cdc3b18..e39d9e5fba1f 100644\r
81 --- a/doc/man1/notmuch-emacs-mua.rst\r
82 +++ b/doc/man1/notmuch-emacs-mua.rst\r
83 @@ -18,10 +18,6 @@ Supported options for **notmuch-emacs-mua** include\r
84      ``-h, --help``\r
85          Display help.\r
86  \r
87 -    ``--client``\r
88 -        Use emacsclient, rather than emacs. This will start\r
89 -        an emacs daemon process if necessary.\r
90 -\r
91      ``-s, --subject=``\ <subject>\r
92          Specify the subject of the message.\r
93  \r
94 @@ -38,7 +34,15 @@ Supported options for **notmuch-emacs-mua** include\r
95          Specify a file to include into the body of the message.\r
96  \r
97      ``--no-window-system``\r
98 -        Even if a window system is available, use the current terminal\r
99 +        Even if a window system is available, use the current terminal.\r
100 +\r
101 +    ``--client``\r
102 +        Use **emacsclient**, rather than **emacs**. This will start\r
103 +        an emacs daemon process if necessary.\r
104 +\r
105 +    ``--create-frame``\r
106 +         When --client is specified, create a new frame instead of trying\r
107 +         to use the current Emacs frame.\r
108  \r
109      ``--print``\r
110          Output the resulting elisp to stdout instead of evaluating it.\r
111 diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua\r
112 index 13f67bee4417..68c2643df581 100755\r
113 --- a/notmuch-emacs-mua\r
114 +++ b/notmuch-emacs-mua\r
115 @@ -31,12 +31,12 @@ EMACS=${EMACS-emacs}\r
116  EMACSCLIENT=${EMACSCLIENT-emacsclient}\r
117  \r
118  PRINT_ONLY=\r
119 +NO_WINDOW=\r
120  USE_EMACSCLIENT=\r
121 -CLIENT_TYPE="-c"\r
122 +CREATE_FRAME=\r
123  \r
124  # The crux of it all: construct an elisp progn and eval it.\r
125  ELISP="(prog1 'done (require 'notmuch) (notmuch-mua-new-mail)"\r
126 -ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"\r
127  \r
128  # Short options compatible with mutt(1).\r
129  while getopts :s:c:b:i:h opt; do\r
130 @@ -60,7 +60,7 @@ while getopts :s:c:b:i:h opt; do\r
131                     opt=${opt%%=*}\r
132                     ;;\r
133                 # Long options without arguments.\r
134 -               --help|--print|--no-window-system|--client)\r
135 +               --help|--print|--no-window-system|--client|--create-frame)\r
136                     ;;\r
137                 *)\r
138                     echo "$0: unknown long option ${opt}, or argument mismatch." >&2\r
139 @@ -80,9 +80,6 @@ while getopts :s:c:b:i:h opt; do\r
140         --help|h)\r
141             exec man notmuch-emacs-mua\r
142             ;;\r
143 -       --client)\r
144 -           USE_EMACSCLIENT="yes"\r
145 -           ;;\r
146         --subject|s)\r
147             ELISP="${ELISP} (message-goto-subject) (insert \"${OPTARG}\")"\r
148             ;;\r
149 @@ -102,7 +99,13 @@ while getopts :s:c:b:i:h opt; do\r
150             PRINT_ONLY=1\r
151             ;;\r
152         --no-window-system)\r
153 -           CLIENT_TYPE="-t"\r
154 +           NO_WINDOW="-nw"\r
155 +           ;;\r
156 +       --client)\r
157 +           USE_EMACSCLIENT="yes"\r
158 +           ;;\r
159 +       --create-frame)\r
160 +           CREATE_FRAME="--create-frame"\r
161             ;;\r
162         *)\r
163             # We should never end up here.\r
164 @@ -121,6 +124,14 @@ for arg; do\r
165      ELISP="${ELISP} (message-goto-to) (insert \"${arg}, \")"\r
166  done\r
167  \r
168 +# If reusing a frame in emacsclient, don't kill the buffer.\r
169 +if [ -z "$CREATE_FRAME" ]; then\r
170 +    ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"\r
171 +elif [ -z "$USE_EMACSCLIENT" ]; then\r
172 +    echo "$0: --create-frame is only applicable with --client." >&2\r
173 +    exit 1\r
174 +fi\r
175 +\r
176  # End progn.\r
177  ELISP="${ELISP})"\r
178  \r
179 @@ -131,7 +142,7 @@ fi\r
180  \r
181  if [ -n "$USE_EMACSCLIENT" ]; then\r
182      # Evaluate the progn.\r
183 -    exec ${EMACSCLIENT} ${CLIENT_TYPE} -a '' --eval "${ELISP}"\r
184 +    exec ${EMACSCLIENT} ${CREATE_FRAME} ${NO_WINDOW} -a '' --eval "${ELISP}"\r
185  else\r
186 -    exec ${EMACS} --eval "${ELISP}"\r
187 +    exec ${EMACS} ${NO_WINDOW} --eval "${ELISP}"\r
188  fi\r
189 -- \r
190 2.1.4\r
191 \r