From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Voit Newsgroups: gmane.emacs.help Subject: Re: Emacs 24.5.1 has wrong charset on yanked text with Windows (was: Operating on yanked region) Date: Thu, 9 Jun 2016 12:10:57 +0200 Organization: www.karl-voit.at Message-ID: <2016-06-09T11-43-44@devnull.Karl-Voit.at> References: <2016-05-18T13-02-10@devnull.Karl-Voit.at> <2016-05-18T14-10-52@devnull.Karl-Voit.at> <20160518123117.GA13317@tuxteam.de> <2016-05-18T17-35-17@devnull.Karl-Voit.at> <20160519083835.GB20522@tuxteam.de> Reply-To: Karl Voit NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1465467124 24484 80.91.229.3 (9 Jun 2016 10:12:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 9 Jun 2016 10:12:04 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 09 12:11:50 2016 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 1bAwwH-0001ZX-Rx for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Jun 2016 12:11:50 +0200 Original-Received: from localhost ([::1]:33556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAwwG-0002QH-Tc for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Jun 2016 06:11:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAwvf-0002O4-Tr for help-gnu-emacs@gnu.org; Thu, 09 Jun 2016 06:11:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAwvb-0006fi-Kk for help-gnu-emacs@gnu.org; Thu, 09 Jun 2016 06:11:10 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:50705) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAwvb-0006fe-DY for help-gnu-emacs@gnu.org; Thu, 09 Jun 2016 06:11:07 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1bAwvZ-000173-2L for help-gnu-emacs@gnu.org; Thu, 09 Jun 2016 12:11:05 +0200 Original-Received: from friends.grml.info ([136.243.234.19]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Jun 2016 12:11:05 +0200 Original-Received: from news1142 by friends.grml.info with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Jun 2016 12:11:05 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 69 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: friends.grml.info X-GPG-Key: http://www.Karl-Voit.at/Karl_Voit_GnuPG_public_key.gpg X-Registered-Linux-User: 224337 X-Confession: Pastafarian http://www.venganza.org/ User-Agent: slrn/pre1.0.0-18 (Linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:110391 Archived-At: * wrote: > > On Wed, May 18, 2016 at 05:53:51PM +0200, Karl Voit wrote: >> * wrote: > > [...] > >> I once set this to 'utf-8 in my init.el. The Emacs help further >> suggests setting it to 'utf-16le-dos instead when running on >> Windows. With switching to this setting, the clipboard gets yanked >> properly! :-) > > That's interesting, since Eli says it shouldn't be necessary on > Windows (and he sure knows a hell of a lot more about Emacs than > I do, and much more so specifically about Emacs on windows). > > That'd mean that your Emacs is confused somehow, but why? I just answered to Elis posting which should also answer the question of my (faulty) configuration. > [...] > >> Can you still show me how I yank and operate (string-replace) only >> on the yanked text? > > I don't know exactly what you want to achieve (manual operation, or > ultimately some automatism?), but you might start here: What I want to achieve (I should have started with this one in the first place): yanked text from Outlook had wrong charset (fixed!) and a different syntax for list items. I am trying to automate it so that I can paste to Org-mode and get Org-mode syntax for list items. Therefore I want to search&replace within the yanked text to look for Outlook bullet point snippets and replace them accordingly. > - after a (normal) yank, the last mark is at the start of the > yanked text and point at its end (but mark is not active). > So if you activate it, e.g. by > > M-x eval-expression RET (activate-mark) RET > > you get the just yanked stuff "selected". You'll have to > wrap some of that into commands to make it practical, though. > Season to taste. Wow, this is great news. Thanks! > - there isn't, AFAIK, a hook hanging off the yank event itself > (a pity, IMHO), but if you somehow manage to attach the text > property named 'yank-handler (having as value a function + > arg provided by you), then this function gets the chance to > do its thing just after yanking. > > Search for "yank-handler" in the Emacs Lisp manual. I'm a > bit pressed now, but if you nudge me I'd be willing to whip > up an example. Cool help! I am not sure if I want to modify yanking in general. I was thinking of defining my-outlook-yank or similar that does the additional stuff. -- All in all, one of the most disturbing things today is the definitive fact that the NSA, GCHQ, and many more government organizations are massively terrorizing the freedom of us and the next generations. http://Karl-Voit.at