texts: In org mode, how do I make DONE tasks show up each time they've been DONE?

texts:
Org agenda shows tasks only on the scheduled date, not when those tasks were actually one. There are two cases that I see here:

1. Tasks not done on day scheduled

If a task is scheduled for Sunday, but marked DONE on Monday, the task will be shown in the agenda (as DONE) for Sunday. This task -- if put into a file listed in org-agenda-files -- will show the behavior:

* DONE this shows up in agenda on Sunday, but not Monday.
CLOSED: [2015-09-14 Mon 12:22] SCHEDULED: <2015-09-13 Sun>

2. Recurring tasks that have ever been done

A recurring task shows up (as TODO) on the date it's scheduled on and any dates it will recur on. But it won't show up (as DONE) on dates it was DONE on. This task shows the behavior:

* TODO this task shows up on Monday, and every day after, but not the Sunday it was done on.
SCHEDULED: <2015-09-14 Mon +1d>
- State "DONE"       from "TODO"       [2015-09-13 Sun 23:59]
:PROPERTIES:
:LAST_REPEAT: [2015-09-13 Sun 12:26]
:END:

I think these two things are the same behavior -- show tasks as DONE on days they were done on, nevermind when they were scheduled.

I could possibly make a custom view that contains, for a given set of dates, all tasks scheduled for those dates, and all tasks done on those dates, but that would basically be a reimplementation of org agenda. I'd also lose out on all the features built around the agenda.

The org documentation seems to hint that this is not customizable:

  As a consequence of shifting the base date [by marking a repeating
  task done], this entry will no longer be visible in the agenda when
  checking past dates, but all future instances will be visible.


texts:
When listing ELPA packages (Mac running Emacs 26.1), I see two status types that beg questions: dependency and incompat.

A dependency package does get automagically loaded but it also may be removed via M-x package-autoremove as there appears to be a high correlation between dependency packages and those offered up for removal by package-autoremove. This does not seem right to me.

It strikes me that an incompat package is bad thing and that it should be removed, but I do not see an easy way to do this so maybe I have this one wrong.


texts: org-crypt fails with Error: (error “Encrypt failed”)

texts:
I'm trying to encrypt entries with org-crypt, but I get this unhelpful error message:

  No crypt key set, using symmetric encryption. Error: (error "Encrypt
  failed")

It correctly recognizes that I want symmetric (i.e. passphrase) encryption, but doesn't ask for one, and fails instead.

For reference: if I run epa-encrypt-file I do get a dialog for passphrase entry in the minibuffer.

This is the relevant config:

(require 'epa-file)
(require 'org-crypt)
(epa-file-enable)

(setq epa-pinentry-mode 'loopback)

;;; (setenv "GPG_AGENT_INFO" nil)

(org-crypt-use-before-save-magic)

(setq org-tags-exclude-from-inheritance (quote ("crypt")))

;;; GPG key to use for encryption

;;; Either the Key ID or set to nil to use symmetric encryption.

Edit: this is the stack trace - still not very informative...

Debugger entered--Lisp error: (error "Encrypt failed")
  signal(error ("Encrypt failed"))
  error("Encrypt failed")
  org-encrypt-entry()
  org-scan-tags(org-encrypt-entry (lambda (todo tags-list level) (progn (setq org-cached-props nil) (or (and (member "crypt" tags-list))))) nil)
  org-encrypt-entries()
  run-hooks(before-save-hook)
  basic-save-buffer(t)
  save-buffer(1)
  funcall-interactively(save-buffer 1)
  call-interactively(save-buffer nil nil)
  command-execute(save-buffer)


texts:
I am looking into setting up an Arduino IDE environment in Emacs (on both PC and OS X). I came across the EmacsWiki ArduinoSupport page, which has a good guide for Mac OS X and Linux, which is perfect.

However, I have a couple of questions:

Does such a guide for Emacs on windows exist? I find it a bit of an
odd omission from the page. Don't get me wrong, I don't like using
Windows at all, but my Arduino will not connect to my Mac and so I am
somewhat obliged to use Windows 7 to develop for it.
Has anyone used or followed the above guide for Arduino on Emacs on Mac OS
X? Is it a good guide, or are there better options out there?

I didn't know whether to ask this on the SE Arduino site, but it is more Emacs configuration related than Arduino.


texts: How to know which packages have been installed?

texts: Currently  I am experimenting with Emacs and playing with many el files. Sometimes packages are installed from those el files or I install with a command M-x package-install. But this may cause trouble in the future if I want to replicate my emacs configuration in other computers. Is there a way to keep informed which packages installed in my system and save them in one file automatically?


texts: Hook that indicates when the cursor has been moved by scrolling

texts:
Inspired by this question: Let Emacs move the cursor off-screen, I am considering writing a minor mode that will keep the cursor in a fixed position that is not affected by scrolling operations.  I have some ideas of how I might implement this, but it would require a hook to let me know when the cursor is being "pushed" off of the screen.

Somewhere within the bowels of Emacs, there exists code that is called when the location of point is being moved off of the display.  While it has been said that the code that controls this behavior lives deep with the C source code, I would like to know if there is any way that I can be notified when it is about to happen.

Is there any way that I can be notified when a scrolling command is about to move the cursor?  Or at least, is there a way that I can be notified when the display is about to be scrolled?

Update: I am no longer planning on writing a minor mode to achieve this because a new package was just released on GNU ELPA called scroll-restore that provides exactly the features that I was thinking of implementing myself!


texts: How to debug the "message" function on entry ?

texts:
While debugging a minor mode (separate issue), I wanted to generate a stack trace of the message function so I thought I would just enter

M-x debug-on-entry RET message

I was quite surprised to see that this method did not work. No stack trace was generated instead I started to get the error

Lisp nesting exceeds `max-lisp-eval-depth'

Which probably means that the message function was being called from the debugger, and debugger was calling message again making an infinite loop. Is there a more fool-proof way of generating full traces of who called the message function ?


texts:
I love vim keybindings. For older versions of Magit, I used this to allow j/k scrolling:

(define-key magit-status-mode-map (kbd "k") #'previous-line)
(define-key magit-status-mode-map (kbd "K") #'magit-discard-item)
(define-key magit-status-mode-map (kbd "j") #'next-line)

But now, of course, the keymaps have changed. I have a sort of hacked up solution that loops through all the keymaps, but it's quite complicated and brittle.

Is there any easy way to customize keybindings in magit?


texts: Specifying how history is managed for each buffer

texts:
After editing a couple of encrypted files with Emacs and EasyPG Assistant I realized that parts of those files were still stored in various lists within Emacs, e.g the kill-ring and the minibuffer history. This, along with things like savehist, increases the chances of sensitive information leaking.

Is there a way to specify that history should be handled differently for some buffers? E.g. that they should each have their own kill-ring and minibuffer history that is purged on buffer close and not actually stored anywhere?


texts:
Suppose I have a gmail account, say foo@gmail.com with a password: foopassword.

What are the simplest steps to go through, to read my emails?
Does it make any difference whether I'm using Windows or Linux?


texts: org-babel: Make results always quote the returned value in #+begin_example

texts:
Github's org parser has a bug where they mistakenly show

#+begin_src bsh.dash :results verbatim :exports both
echo | time possiblycat 1000
#+end_src

#+RESULTS:
:
: possiblycat 1000  0.00s user 0.00s system 75% cpu 0.006 total; max RSS 1852

as

(I have reported this on Github.)
I want to workaround this by quoting the result:
#+RESULTS:
#+begin_example
...
#+end_example

How can I do this automatically?


texts: how to locate files with helm-for-files using ssh

texts: I want to use helm-for-files to search for files on remote hosts. It would be great if I could use /ssh: like in helm-find-files to display all hosts in my ssh config file. After choosing one host I'd like to have the recent file and locate helm display like in helm-for-files instead of a dirtree.


texts: how to show local file listings with C-x C-f through IVY when starting in a remote file buffer

texts:
System: Mac OSX catalina
Emacs: 26.3

I use Ivy as my completion framework.

Problem is when I am editing a remote buffer over ssh using Tramp, and then I want to look at a file on my local machine.

If I do C-x C-f, I get my dialogue, but I can only see options for the remote machine.  I can't delete my way out of the tramp listings.  So what I do now is I first C-x b into the scratch buffer, then do C-x C-f to see local machine listings.  Is there a way to do this in a more natural fashion?

For example when attached via tramp, hitting backspace/delete at this point does nothing further:

So I go the scratch buffer and then I can get this:


texts: Org file created on Windows machine. Incorrect open in Linux machine

texts:
Emacs 26

On Windows 10 machine create any org file.

Nice.
Now on Linux Mint try to open same org file.

Here result:

Why not correct open org file?


texts: How to prevent preview-latex to manipulate and delete the pdf created by latex

texts: Running latex-preview manipulates and then deletes the pdf created by latex. If skim is open as pdf-viewer the pdf gets sliced into the images created by latex-preview. Running latex again doesn't update the pdf-view in skim. The problem of vanishing the pdf file is already listed on the package homepage https://www.gnu.org/software/auctex/manual/preview-latex.html under B.5.2 and B.5.3. There is mentioned as an explanation that Preview-latex uses the filename of the original output file for the creation of preview images. But neither on that homepage nor somewhere else I was able to find a solution in order to prevent this. So how can I prevent preview-latex to manipulate and delete the pdf file?


texts: For what languages is `syntax-ppss` appropriate?

texts:
I've been looking at a way of detecting whether point is on a comment by looking at how the current buffer is fontified.

Smartparens defines sp-point-in-comment, which relies on syntax-ppss. However, it seems that syntax-ppss and parse-partial-sexp can be used for arbitrary languages, even if they don't use s-expressions.

For example, this Python:

x = 1
# I'm a comment
y = 2

Placing point inside the comment and evaluating (if (nth 4 (syntax-ppss)) 'comment 'not-comment) works correctly.

Does syntax-ppss work for any programming mode? Why do the docstrings discuss s-expressions?


texts: Symbol's value as variable is void: command

texts:
I wonder why this keybind start not working, it used to work but not today.

;; defun my-exwm-launch
(defun my-new-exwm-launch (command)
  (lambda ()
    (interactive)
    (start-process-shell-command command nil command)))

(exwm-input-set-key (kbd "s-g") (my-new-exwm-launch "gkamus"))

I think I have this problem in the past too and I solved it by giving it lambda
but that solution not work anymore

Update
If I move the function and function to set keybind in
elisp or .el file, it work

but If I use .org as dotfiles it not working
I use this to load org file as dotfiles

(require 'org)
(org-babel-load-file (expand-file-name "~/.doom.d/personal/cheats_conf.org"   user-emacs-directory))


texts:
I'm unsure how to use checkboxes in Emacs. I'm using Emacs 24.3.

The documentation suggests the use of org-toggle-checkbox as "With a single prefix argument, add an empty checkbox..."

I've tried starting with an existing list (with org-mode as the major mode), as in:

* shopping list
** eggs
** bread
** Tesla Model S
** bacon

Whether I put point in "shopping list", or in "eggs", pressing C-u C-c C-x C-b (which runs org-toggle-checkbox) results in the error "No item in subtree" being printed to the minibuffer. This behavior happens without my init file (emacs -Q), so it's purely an org-mode issue.

What's the right way to start using checkboxes?


texts: How to set Haskell indentation with Prelude

texts:
I'm using Prelude and Haskell mode and trying to set the indentation. The default indentation gives me the following:

main = do
  contents <- getContents
  print (sumFile contents)
  where sumFile = sum . map read . words

I'd like to have it indented like this:

main = do
    contents <- getContents
    print (sumFile contents)
  where sumFile = sum . map read . words

I tried to set M-x customize-option RET haskell-indentation-left-offset, set the value to 4, chose "Apply and Save" and nothing happened.

How do I fix the indentation? Thanks.


texts: Send command to run in eshell, after compiled

texts:
So I've been mapping my M-x compile like this, according to c-mode-hook or c++-mode-hook:

(add-hook 'c++-mode-hook
          (lambda ()
            (set (make-local-variable 'compile-command)
                 (concat "g++ " buffer-file-name " && ./a.out"  ) )))

In other words, doing M-x compile on a c or c++ file will compile and run it.

This works but I want this to be a 2 part process. So, I will have a buffer that contains the errors from running M-x compile and another buffer, maybe eshell, that is ready to run the program.

The first one is easy, I can just do this:

(add-hook 'c++-mode-hook
          (lambda ()
            (set (make-local-variable 'compile-command)
                 (concat "g++ " buffer-file-name) )))

This does not run the ./a.out part.  Now, for the second part, I know that I can just do M-x eshell, then type ./a.out and the program should run.

My question is: Is it possible to tell emacs to send "./a.out" in current directory to eshell/term? I would then have a third buffer opens that is eshell/term, where the program runs. And then I would like to bind a shortcut to this, say F6.


texts:
In emacs prelude ruby mode, how I tell emacs to not do intellisense dropdown suggestions?

It breaks my flow. Because I have to press an additional key to break out of that menu.

What I tried: google "Turn off prelude intellisense"


texts:
When I open a file via tramp on a remote machine and then start a shell with M-x shell I get an infinite loop because of my .cshrc file.

I want to use a newer gcc version in CentOS so I have:

set X="`gcc -dumpversion`"
if ($x != "4.8.2") then
  scl enable devtoolset-2 tcsh
endif

It seems that inside emacs the gcc -dumpversion always gives 4.4.7 and the scl enable is run an infinite number of times. (The scl enable starts a new shell.)

When I ssh into this machine it starts fine with gcc 4.8.2.

Do I have to use any settings to get the shell in emacs tramp to work?


texts: Magit - problem doing a second commit related to the GIT_EDITMSG buffer

texts:
This looks similar (the same?) as How to prevent Magit from saving COMMIT_EDITMSG? but I've also confirmed that the problem isn't magit itself, but interactions with settings or other packages.

I'm having the same issue as 46965 (though it just started recently) -- my second commit goes to the previous git commit and bypasses the options for commits.

I am definitely using C-c C-c to commit and I see the commit in the log.

I tried running a bare magit using the info in the debug section of the manual -- that instance worked as it's supposed to (goes to the options). So it sounds like either settings or other packages are causing the problem. I turned off all other magit packages (magit-section, magit-todos, vdiff-magit) but the problem is still there.

Has anyone else seen this behaviour and found out what the offending setting/package is?

My setup: Magit 20200228.1207, Git 2.25.1, Emacs 28.0.50, gnu/linux


texts: Every time I dock/undock I must hit 10 times M-x zoom-frm-in. Since I don't understand the dotimes example in the lisp tutorial I need to know how you would automate this task.


texts: How can I make Emacs wait until a file is unlocked and then lock it?

texts:
I want to override Emacs' default locking behavior to work in a noninteractive setting. To that end, when Emacs encounters a lock (as in file-locked-p), I would like it to wait patiently for the lock to disappear and then claim the file for itself. The naive implementation of such a scheme would look something like:

In theory, this should be achievable by overriding/advising ask-user-about-lock something like this:

(define-advice ask-user-about-lock (around (oldfun file opponent) wait-when-noninteractive)
  (if noninteractive
      ;; Non-interactive: wait for lock to disappear and then steal
      (prog1 t
        (while (stringp (file-locked-p file))
          (sit-for 1)))
    ;; Interactive: ask use as normal
    (funcall oldfun file opponent)))

However, I believe this creates a race condition, since multiple Emacs processes could be waiting on the same lock and if both notice the lock disappear, they will both attempt to claim the lock. Is there a better way to implement this behavior that won't create a race condition?

If anyone is curious why I want this, the reason is that my init file briefly locks a file during Emacs startup, and I have an Org-mode file that I would like to export to multiple formats asynchronously each time it is saved. Each async export job starts a new Emacs process, and each of these processes try to lock that same file during init, and all but one of them hang waiting for the user to tell them whether to steal the locked file. Having them simply wait and access the file one at a time instead would be idea.


texts:
Is there a way to temporarily disable scrolling in an emacs buffer? I would like to "lock" a particular line to be (say) the top of the displayed portion of the buffer, so that if I accidentally try to scroll it off screen I would be prevented from doing so, and it stays visible.

(I'm using org-mode, so if I want to see/type further down than what is currently the bottom of the screen, I want to do it by collapsing sections between the top of the screen instead of accidentally scrolling away.)

As a workaround I can split the buffer into two windows horizontally and work in the bottom buffer (keeping the top one fixed), but I'd rather use one window that just doesn't move.

(Note, in case it matters: My keyboard doesn't have a "Scroll Lock" key, and even when it did I never learned what it would do either in Emacs or in any other application.)


texts:
i've installed jdee from package-list it was elpa i think .. color highlight and indentation are working fine . but

when i run any command ( JDEE commands )  i get this message :

  Customize ‘jdee-server-dir’ to point to dir with JDEE jars. See
  http://github.com/jdee-emacs/jdee-server

will i visited the link i don't know where to find the bundle files ?


texts: How do I use emacsclient to connect to a remote emacs instance?

texts:
I'd like to be able to run emacs on one computer:

server $ emacs --daemon

And then connect to it from another:

local $ emacsclient -c server

Is this possible? If so, how?


texts:
(Using latest version of Spacemacs, on Windows)

I'm new to org-mode and really need to figure out how to get completion working for stuff like tags and #+ options. Apparently org uses pcomplete as the completion backend. Indeed M-x pcomplete (helm) does offer a buffer with long list of completions for #+.

The manual says various completions are accessible with TAB and M-TAB. TAB works fine for blocks. But M-TAB is alt-tab in Windows and therefore cannot possibly be used. I think most Linux DE's also use alt-tab for window switching, while the dedicated Meta key has not been seen on keyboards for ages — which really makes me wonder why is this is still the default for such an important feature as completion.

I tried (global-set-key (kbd "<f1> 1") (kbd "M-<TAB>")) and (global-set-key (kbd "<f1> 1") (kbd "M-TAB")). Now <f1> 1 is mapped to "Keyboard macro", but it doesn't invoke pcomplete (or anything else in org).

So: How do you remap M-TAB?

(Note: I looked for an answer online and the stuff I tried is what I found. Doesn't seem to work)

(Note2: I've tried ESC TAB and C-M-i (since helm says that's what M-TAB is mapped to), but these keys just jump the cursor to the next line and nothing else.)


texts: How to automatically enable a mode for only one specfic type of buffer?

texts: I user dired to browse file, and I would like to use hl-line-mode which highlights the currents line, but I only want it to be enabled automatically when using dired


texts:
I want an emacs SQL indentation function with the following properties:

Upcase { select, from, as, where, group by, order by, asc, desc, and, or }. -

EDIT: there are sqlup-mode.el and sql-upcase.el which both address this part of the problem.

Maintain an invariant that { select, from, where, group by, order by } are followed by a newline.
All select, where, group by and order by clauses are on their own line.
2 space indentation for non-top-level stuff
AND and OR elements of WHERE clause is indented.

Example:

before:

select foo, bar, count(1) as foo_bar_count
from mytable
where foo = 1 and bar = 2
group by foo, bar
order by foo desc

after:

SELECT
  foo,
  bar,
  count(1) AS foo_bar_count
FROM
  mytable
WHERE
  foo = 1
  AND bar = 2
GROUP BY
  foo,
  bar
ORDER BY
  foo DESC

I haven't found a reference to anything like this.

Questions:

For point 1, the following seems to be sufficient:

(defun kb/sql-upcase-keywords()
  (interactive)
  (goto-char (point-min))
  (while (re-search-forward "^[ \t]*\\(select\\|from\\)" nil t)
    (replace-match (upcase (match-string 1)))))

For point 3 - is there an example of elisp which inserts newlines efficiently?  I have hacked the following

(defun kb/sql-add-newlines()
  (interactive)
  ;; (save-excursion)
  (goto-char (point-min))
  (while (re-search-forward
         "^[    ]*\\\\(select\\\\|from\\\\|where\\\\|group by\\\\|order by\\\\)[    ]*\\\\([^   ]*\\\\)"
          nil t)
    (message "Match found at %s" (point))
    (replace-match "\\\\1\n\\\\2")
    (previous-line)))

Is there a better way of doing this?
(The previous-line call seems to be needed in order to match select foo\nselect foo)
Is there a simpler way forward that I am missing?


texts:
Example: R̅E̅S̅

What I already tried, to no avail: Type R, followed by C-x 8 RET OVERLINE RET

What works but is not nice: Copy the example above and edit it.


texts:
How can I filter directory contents to return the highest numeric named directory? For example, suppose (directory-files "/some/dir") returns:

  ("." ".." "4.03.0" "4.02.9" "archives" "config" "log")

How can I extract the string "4.03.0"?

I tried using seq-remove with a regexp based predicate, but could not get it to work. Suggestions and insights appreciated. Thanks.


texts:
I have two versions of a file (or buffer) and I'm running ediff to compare them. Some of the changes are irrelevant and I want to ignore them. Specifically, foo has been renamed to bar in places and I don't care about that. Note that both versions have both foos and bars, just in different mixes.

How can I ignore regions where foo → bar is the only change? Either with Ediff itself, or with a third-party package, or with an external diff replacement that's easily available on Linux.

If foo+corge has changed to bar+baz, I do want to know about the change from corge to baz (whereas a change from foo+corge to bar+corge should be ignored). So I don't think that selective browsing (#h) can help me. What I really want to ignore is changes, not regions — though if a region has non-ignored changes, I don't mind if the refinement also highlights the ignored change.


texts: Link to footnote export as non-superscript

texts:
Links to a footnote automatically exports as superscript in LaTeX.
Source:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. [fn:1685d75dd9ccdec5: This is a footnote.] In sed erat porta, sodales mauris congue, volutpat nisi. Integer in justo ac augue vehicula sodales ac quis enim. [fn:4194cf1977de9b2:Please refer to footnote [fn:1685d75dd9ccdec5].]

TeX:
Please refer to footnote \textsuperscript{\ref{orge6f2964}}.

Is there a setting that can turn off this feature so that this specific link is exported normally?
Please refer to footnote \text{\ref{orge6f2964}}.

Expected Results:
I would like links in the main text to remain super-scripted.

While those within footnotes to be in normal text.

i.e. Please refer to footnote 2.


texts: query-replace{-regexp} fails in linux in a non-X terminal when I am in anything other than text mode

texts:
I am running emacs 26.1 under linux. It has been working fine for over a year. Recently, I upgraded a lot of packages on my machine, but I did not upgrade nor alter emacs in any way. Now, query-replace and query-replace-regexp are failing when I run either of them in a non-X terminal with the -nw emacs command-line flag when not in text-mode. This failure never used to occur before my system upgrades. And it turns out that query-replace{-regexp} still work fine in all cases when I start emacs in an X window.

For example, suppose I have the following data in a file called test.txt ...

AAAA
BBBB
CCCC
DDDD

If I run emacs -nw test.txt, then position to the top of the file and run (query-replace "AAAA" "XXXX"), it works. However, if I run (emacs-lisp-mode) and then run (query-replace "AAAA" "XXXX") in the same way, I get this result (with debug-on-error set) ...

Debugger entered--Lisp error: (args-out-of-range #<buffer test.txt> 0 1)
  buffer-substring-no-properties(0 1)
  perform-replace("AAAA" "XXXX" t nil nil nil nil nil nil nil nil)
  query-replace("AAAA" "XXXX")
  eval((query-replace "AAAA" "XXXX") nil)
  eval-expression((query-replace "AAAA" "XXXX") nil nil 127)
  funcall-interactively(eval-expression (query-replace "AAAA" "XXXX") nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

However, if I leave off -nw and do all the same things in an X-Window instance of emacs, (query-replace ...) always works.

In other words, with emacs test.txt (i.e., no -nw flag), I never get this problem with query-replace, no matter what mode I am running in.

This is not only specific to emacs-lisp-mode. The error with query-replace in a non-X terminal buffer also occurs for sh-mode and some other modes.

Does anyone know what could be causing this error and what I have to do to fix it?

Thank you in advance.

UPDATE:

This error does not occur when I am running from my system console (i.e., no X services running at all). The errors I saw did occur in xterm and urxvt windows under my X desktop manager, even when I have explicitly unset DISPLAY.

It seems like there is something about running within an X desktop manager which is confusing emacs with regard to buffer attributes when running with -nw, even with DISPLAY unset.

And again, this problem only started happening a short time ago after updating a number of software components, but with no changes to emacs, at all. I have rebooted a few times since then, to no avail.

FURTHER UPDATE:

This error does not occur when I run (replace-string "AAAA" "XXXX").


texts:
Q: how do I split a complicated string when whitespace
delimiters aren't discriminating enough?

Background

I'm working with BibTeX files.  I want to split an author string
of the form "first-name middle-name last-name" into its tokens.

Doing so is straightforward when each name is a single word
because we can split by whitespace:

(split-string "Adam Smith")             ; => ("Adam" "Smith")

Problem: double-barrelled names

The problem is that some names (usually last names, but not
always) are multiple words separated by whitespace.  BibTeX
handles that by enclosing the name entities in curly braces, as
with "Martin {Van Buren}".  Here, a simple whitespace split gives
the wrong answer

(split-string "Martin {Van Buren}")     ; => ("Martin" "{Van" "Buren}")

Question: split complicated names?

So: how do I split complicated names that a) can have an arbitrary
number of names, and b) each curly-braced name component can have
an arbitrary number of whitespace-separated chunks?

Example desired output

Given a hypothetical function fancy-split, I'm looking to
extract a list of name components:

(fancy-split "A Simple Name")           ; => ("A" "Simple" "Name")
(fancy-split "Walter J. {Fancy Pants}") ; => ("Walter" "J." "Fancy Pants")
(fancy-split "Ed {Big D} {del Mar}")    ; => ("Ed" "Big D" "del Mar")
(fancy-split "John {El Guapo} Smith")   ; => ("John" "El Guapo" "Smith")


texts: Merging changes to/from DOCX files into org-files

texts:
I believe this to be a very common problem faced by many of us org-mode users. I haven't been able to find a duplicate to my question, though, so I am posting it here.

How do you share your org-mode files with collaborators/supervisors who only use Microsoft Word, and how do you merge their changes back into your org-mode file? Is there a package that takes care of these things?

Ideally I would want to merge the "tracked" changes from a .docx file directly into my org-document, and then use the magit interface to slowly stage the changes I consider relevant.

In any case, all pointers and tips that can make the org/word workflow less of a pain are welcome. Dropping Org-mode in favor of MS Word is by all means not acceptable.


texts: Start emacs from the command line with remote ssh file open

texts:
How to start Emacs from the command line with and open file trough ssh?
What I usually do is first open Emacs and do:
C-X C-F /ssh:my_remote_server:/file.txt RET
How can I directly open the file from the command line doing something similar to:
emacs --remote "/ssh:my_remote_server:/file.txt"


texts: How to add to top of collapsed header tree?

texts:
Is there any way to default adding text to the top (rather than bottom) of a collapsed header tree?

Say I have these headers

* Main header
** Notes
*** Notes sub-section 1
** Subheader 2
*** Subheader 2.1

And collapsed they appear

* Main header
** Notes...
** Subheader 2...

If I add text to a collapsed tree:

* Main header
** Notes...
<return> text added here ->
** Subheader 2...

Current result:

* Main header
** Notes
*** Note sub-section 1
text added here
** Subheader 2...

Desired result:

* Main header
** Notes
text added here
*** Note sub-section 1
** Subheader 2...


texts: Org-mode not exporting frames correctly using beamer

texts:
I'm writing a presentation using Org-mode and beamer. The problem is that all the frames are putted into a single one. I have the following code:

#+TITLE: \textbf{example}
#+AUTHOR: \large{sdjfioa}
#+DATE:
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [presentation,smaller]
#+LaTeX_HEADER: \usetheme{Ilmenau}
#+LaTeX_HEADER: \usecolortheme{beaver}
#+OPTIONS: H:2 toc:nil title:nil
* This is the first structural section

** This should be a frame
but it is not

** This should be another frame
fajsiodjfoiasjdfoii

the exported .tex file contains the following:

\begin{document}

\maketitle
\section{This is the first structural section}
\label{sec:org7d325e6}

\subsection{This should be a frame}
\label{sec:org5055c4a}
but it is not

\subsection{This should be another frame}
\label{sec:orgcbe0add}
fajsiodjfoiasjdfoii
\end{document}

And the pdf is like this


texts: How to quickly open links in org-mode headlines

texts:
I use an org file for storing bookmarks. In each org-headline I have a short description of and a link to the file or location I want to open, like this :

* ...
* my notes [[file:c:/users/myname/Dropbox/notes]]
* my projects [[file:c:/users/myname/Dropbox/projects]]
* ...
* ...

When scrolling up and down this list (C-n and C-p, respectively) I like to locate point to the far left of the window. This is visually clearest for me. However, when I want to open the link in a particular headline, I then have to move the point to the right (C-f or M-f) until point overlaps with the link, and then press C-c C-o to open the link at point.

This opening process is unpractical. Therefor, I would like an interactive function that let me jump from the leftside of a headline (or from anywhere inside the headline), into the link, and opening it. How would such a function look like?

Thanks for any suggestions and help!


texts: How to configure emacs to start in the middle of the screen, and not in the top left corner?

texts: Currently have a GUI version of GNU Emacs v.26.3 (on MacOS Catalina, also have a similar version on Ubuntu 16.04), and because I'm just getting started with the editor, I have this question: how do I configure it to start up in the middle of the screen, and not in top-left corner?


texts: Set "Edit with Emacs" major mode to markdown-mode

texts:
I'm using Edit with Emacs to edit Stack Overflow and Stack Exchange sites.
Currently I'm doing it with this message ;-)

When I click on the button under the text area of Chrome browser, I get a new file opened on Emacs.
Current file is named emacs.stackexchange.com/questions/ask, which is opened in Text mode.
I change it to Markdown mode, that makes it more appropriate.

When I press save the file: C-x C-s, the text gets updated in the browser.
Check this question regarding if file is saved locally or not.
But the mode is changed back to Text mode.

Is there a way to open the buffer in Markdown mode?
Is it possible to avoid the change in the mode, when saving the buffer?


texts: C-M-d not working on Emacs GUI OSX using Mac Command key as Meta

texts:
I'm using Emacs GUI on OSX and I've remapped Cmd key to meta by adding the following to a ~/.emacs.d/personal/misc.el file on prelude:

(setq mac-command-modifier 'meta)

Whereas C-M-u works as expected, C-M-d, when using Cmd as meta key, does nothing. If using alt key though, it works as expected.

What can I do to solve this? I've tried typing C-h l to see what's being typed but when I type C-M-d, nothing appears.

Any ideas?

Cheers


texts: Inserting the plus minus unicode symbol ± as a keyboard macro

texts:
I insert the plus minus symbol ± frequently enough that I want to bind it to a key.

From emacs -Q, I've tried this:

(global-set-key (kbd "C-c m") "±")

However, when I enter C-c m, the minibuffer displays C-u 1-, suggesting it's waiting for me to finish entering a sequence.

I can bind C-c m to other symbols:

(global-set-key (kbd "C-c m") "⇔")

This works as expected: C-c m inserts the double-arrow ⇔.

I've tried other keys as well, e.g.

(global-set-key (kbd "C-c a") "±")

This gives the same result: emacs interprets it as C-u 1-.

Is there something special about the plus-minus glyph that makes Emacs intepret it as a prefix argument? Why can't I insert it as I would other characters?

I have solved the immediate problem by defining an abbrev to insert the plus-minus glyph, but I would like to know why the keybindings above don't work.

Update:

Inserting the character via (insert  ) does work:

(global-set-key (kbd "C-c m") (lambda () (interactive) (insert "±")))


texts: Recompile a .gz file in emacs' progmodes directory

texts:
c-electric-lt-gt in cc-cmds.el.gz treats > as a closing paren only if it isn't immediately followed by another >. This behaviour is incorrect for C++11 and I tried to modify it by changing the order of the checks in that function.

How do I recompile this compressed file? Calling byte-recompile-file on cc-cmds.el.gz failed on the first require statement - (require 'cc-defs). However, cc-defs is provided in the cc-defs.el.gz file present in the same directory as cc-cmds.el.gz. Also, simply evaluating (require 'cc-defs) in ielm works without any errors.


texts: Move cursor up or down multiple lines while preserving column

texts:
I find it convenient to move by multiple lines for quickly scrolling up/down:

  ;; replaces forward-sentence
(global-set-key (kbd "M-e")
                (lambda () (interactive) (next-line 3)))

;; replaces backward-sentence
(global-set-key (kbd "M-a")
                (lambda () (interactive) (previous-line 3)))

However, this gives doesn't save the column of the cursor after you switch directions.  For example, suppose a buffer contains the following:

This is line 1.
This is line 2.
This is line 3.

This is line 5.

Put your cursor on the "1" in the first line, then press C-n 3 times, then press C-p 3 times. You should find that you end up back on the "1".

Now, define M-e and M-a using the above keyboard shortcuts. Try putting your cursor on the "1", press M-e once, then M-a once.  Your cursor ends up at the beginning of the first line! (Tested on Emacs 24.5.1).

How can you move multiple lines in one keypress and preserve the column after switching directions? I tried replacing next-line with forward-line... no dice.


texts: line wrapping is adding unwanted prefix text

texts:
Somehow, I must have clicked something that makes my line wrap (M-q) insert text. Here is an example:

line I want to wrap:

- also copied it into the loop that gets executed every time - now we always get degraded results!

results of wrapping:

- also copied it into the loop that gets executed every time - now we
- so it is something to do with unlocking/reset/locking mechanism ..always
- so it is something to do with unlocking/reset/locking mechanism ..get
- so it is something to do with unlocking/reset/locking mechanism ..degraded
- so it is something to do with unlocking/reset/locking mechanism ..results!

How do I turn this off??


texts: live, literate, lean programming with org-mode

texts:
I would like to use lean-mode and org-mode together to write literate code that is also being parsed by the Lean server.

lean-mode (available on melpa) supports a live-coding style of interaction, illustrated here with flycheck-inline output.

I'm aware of Org Mode's sessions, which support a literate style for scripting languages.  Any suggestions about what would be involved in setting this up for Lean?

Here's a currently-not-working example, save as lll.org, notice that cursor-over on the #check line does nothing at present.

#+Title: Can I do literate live coding with lean?
Here I set up some imports.

#+begin_src lean
import topology.basic data.set.intervals
open real set
#+end_src

Now I want to use that information:

#+begin_src lean
#check (Icc (0:ℝ) 1)
#+end_src

Summary of the challenge

I would like the collection of lean source code blocks within one org-mode file to operate as if they were different transcluded portions of one buffer in lean-mode. The Lean server should be active on all of these blocks, and the contents of the blocks should interoperate, e.g., so that import in an earlier block will make the imported definitions available in later blocks. How could this be arranged?


texts:
I use Emacs under Ubuntu.

I would like to bind the make command to a shortcut, so that makefile could be launched. If the compilation fails, I would the error message to be shown in a sub-window or the message bar; otherwise, I would all the sub-windows to be closed except the one containing the main text.

Does anyone know how to realize that? Also which shortcut should be chosen?


texts: Automated conversion to real accented characters

texts:
I use org-mode to maintain a to-read list of articles. An entry in the list is produced by a function that I wrote in ELisp. The function uses bibtex-completion-get-value for the title and bibtex-completion-apa-get-value for the authors of the article.

Currently, an entry can look like this:

* UNREAD  "Fast and Almost Optimal Any-Angle Pathfinding Using the 2\({}^{\mbox{k}}\) Neighborhoods" by Hormaz\'abal, Nicol\'as, D\'\iaz, Antonio, Hern\'andez, Carlos, & Baier, J. A.

To be able to correctly export this list to latex/pdf (see this reply), I would like to automatically replace \'a for á, \'\i for í etc. in the string returned by bibtex-completion-apa-get-value.

Can I achieve this without having to explicitly handle each possible accented character? (which would be considerably more complicated than this code, since the mapped keys would need to be strings such as "\'\i")


texts: A comprehensive list of shortcuts provided by AUCTeX

texts:
Is there a document (pdf if any) that contains a comprehensive list of all shortcuts provided by AUCTeX? I mean a kind of AUCTEX Reference Card but for all shortcuts.

This question is related to my previous question:

Is there a shortcut for \mathrm in AUCTeX?


texts: Is there a row-reduced echelon form for calc mode?

texts:
If i have the matrix
[ [1, 3, -1, -1],
[1, 5, -1, -4],
[-3, 6, 2, 11] ]
is there some RREF routine built in calc?
Note, i don't want to write out of the equation with variables x,y,z and then use solve `a ='.


texts: Dynamic syntax highlighting (font-lock-mode) stops working in emacs 25.3

texts:
About 15-20 minutes into using emacs my syntax highlighting stops dynamically updating. Instead any new text just uses the color of the text right before it.

Any ideas on how to debug this issue or any work arounds? Running M-x global-font-lock-mode (x2) properly refreshes it, but it doesn't re-enable the dynamic syntax highlighting.

The only way to solve the issue I've found is to kill my emacs server and start a new server, but the issue eventually crops up again.

Here are some screenshots of Python code which shows the behavior.

Here it is properly highlighted:

This is what new code looks like after it stops working:

And here's how it looks after running M-x font-lock-mode (x2):


texts: showing buffer list whilst moving through buffer list

texts:
Is there a way to show the list of buffers whilst moving through them?

ie. next buffer would ideally also pop up a list of buffers to show the buffers that are coming up next


texts: Recursively find and replace default setup

texts:
I am following approach for the recursively find and replace in text files not already open.

M-x find-name-dired: you will be prompted for a root directory and a filename pattern.
Find-name (directory): ~/ shows up and I press enter.
Find-name (filename wildcard): shows up and I type *py and press enter
I press t to "toggle mark" for all files found.
I Press Q for "Query-Replace in Files...": you will be prompted for query/substitution regexps.

Up to this point, whenever I do query-replace I always follow the same pattern.

=> Is it possible to by default save this as my default setup and whenever I want to do replacement, can I jump to 5. step and just enter word query to replace with?


texts: C-x C-f results in the error message: "Wrong type argument: commandp, counsel-find-file"

texts:
I opened Emacs, and executed C-x C-f. A beep sounded and the following message appeared in the status line:

Wrong type argument: commandp, counsel-find-file

All I wanted was to open an existing file. What's wrong with my Emacs, and how can I fix it?

GNU Emacs 25.1.1
macOS Sierra Version 10.12.6


texts: How to indent c++ "special" source lines that don't end with semicolons

texts:
I'm working with a system that uses special macros a lot. For instance:

class UDSSLib : public UFunctionLibrary
{
  GENERATED_BODY()
  void foo();
  int i;
}

The problem is the GENERATED_BODY() line. It's not supposed to have a semicolon after it (I guess the macro expansion has that) and I'd like to stick to that style, but as is, everything after it gets indented too far -- as statement-cont syntax rather than statement.
Can I either convince the C syntax analyzer that the specific string GENERATED_BODY() is a complete statement, or else cause the line after it to be indented normally?


texts: Changing file names automatically generated by save-buffer

texts:
When I create an email message in Emacs (C-x m) I generally save the file before sending it. Emacs generates an automatic filename usually with this format:
\*message\*-20210127-065515

How can I customise this file name? I would like to remove the asterisks from the word "message".


texts:
I'm guessing that since Haskell's ghci is not a full-fledged REPL, you can't really use it for defining functions in orgmode source blocks, i.e.,

#+begin_src haskell
doubleMe x = x + x
#+end_src

isn't allowed in the ghci. But then

#+begin_src haskell
let doubleMe x = x + x
#+end_src

works, but

#+begin_src haskell
let doubleSmallNumber4 x = if x > 0
                            then x
                             else x*2
#+end_src

complains about parsing the else. I'm assuming Haskell and orgmode simply don't play well together -- at least when it comes to using orgmode source blocks . . . or am I missing something?


texts: emacs interface to ubuntu package management (apt, dpkg)

texts:
Is there an emacs library for managing packages on Ubuntu,
ie an emacs based alternative to synaptic and aptitude?
Presumably this would be an elisp wrapper around apt, dpkg and friends
and look something like the packages interface ELPA.


texts: Tracking effort and time spent on task for project management

texts:
I would like to use org-mode for project management. With the :Effort: property, I can already track estimates of how much time a certain task will take, and displaying an %Effort{:} column is a great way of having an overview of the total effort.

Now I would like to track the progress on the task(s), i.e., the time spent on a task as reported by a team member. I could not find a similar tag like :Completed: or so. Ideally I would like to see, in column view, a percentage of how much of the task has already been completed, and what the remaining effort (and effort sum in a hierarchy of tasks) is. Is this possible? Would I need to "clock times" (although the precise times when a certain task was worked on by a team member are neither important to nor known by me), or is there a better approach?


texts:
I have a simple alist in elisp like this:

(defvar *oneliners*
  '((js . "//")
    (python . "#")
    ))

I am a bit surprised that searching for the python key gives me nil. I am calling it from within the function:

(defun one (lang)
  (cdr (assoc lang *oneliners*)))

(one 'js) ;; -> "//"

But:

(one 'python) ;; -> nil

What am i missing about elisp's alists?


texts: Setting #+ATTR_LATEX for all images of a document

texts:
I am currently adding an #+ATTR_LATEX before every image in my org-file to center it in the produced LaTeX beamer slides. That is slightly annoying and clutters up the document.

Is there a way to set an #+ATTR_LATEX for all images or even just for the whole .org file?


texts: How do I stop Prolog mode from jumping to the Prolog REPL when consulting the buffer?

texts: Suppose I am using Prolog mode with the Prolog REPL started as an inferior process using CtrlcEnter. Whenever I "consult" (i.e. evaluate) the Prolog mode buffer using CtrlcCtrlb ((prolog-consult-buffer)), I will end up in the Prolog REPL. Is there a way to prevent this? I want to stay in the source code when I "consult" the buffer; I don't want to go to the REPL.


texts: How to open a file in a vertical split after using helm-projectile-find-file?

texts: After selecting a file to load with helm-projectile-find-file, how can one load the target file in a vertical buffer?


texts: evil star & visualstar without moving the cursor

texts:
Is it possible to do something similar to these vim commands with emacs-evil? They basically do the same thing as * and visualstar of vim (and evil) but they do not move the cursor to the next match.

" 1. get current word on the cursor's position `expand('<cword>')`
" 2. wrap it with `'\<'` and `'\>'` to mark it as a word
" 3. put it in the search register `/`
" 4. highlight the matches
noremap <silent>* :let @/ = '\<'.expand('<cword>').'\>'\|set hlsearch<CR>

" 0. call the function that does step 1~3
" 1. copy the selected region into `"` register: `execute "normal! gvy"`
" 2. escape some characters in the copied text with `\`
" 3. put it in the search register `/`
" 4. highlight the matches
vnoremap <silent>* :<C-u>call Searchgvy()\|set hlsearch<CR>
function! Searchgvy()
    " raw text on `"`, escaped text on `/`
    execute "normal! gvy"
    let l:pattern = escape(@", "\\/.*'$^~[]")
    let @/ = l:pattern
endfunction


texts:
When setting multiple tags for emacs headers with the "single key fast selection" all of the selected tags are marked in the list (with color) but only the last one is listed on the "Current" line and actually inserted when I exit. I.e. using single keys I can only insert one single tag, eventhough I select more.

If I hit ! before selecting tags ("groups") then it works as I want it. How can I make this behaviour default?

My org-fast-tag-selection-single-key is set to nil.


texts:
I'm using emacs 25.2 on osx 10.12 and following elisp intro to produce some error message intentionally.

(This is a list)

After I run C-x C-e on this line. A backtrace buffer appeared as supposed but with garbage error messages:

Debugger entered--Lisp error: (void-function This)
  (This is a list)
  eval((This is a list) nil)
  elisp--eval-last-sexp(nil)
  #[257 "\204�\303!\207 \303!\n)B\211A  =\204�\211A\211@\207" [eval-expression-debug-on-error elisp--eval-last-sexp-fake-value debug-on-error elisp--eval-last-sexp] 4 2273792 "P"](nil)
  ad-Advice-eval-last-sexp(#[257 "\204�\303!\207    \303!\n)B\211A  =\204�\211A\211@\207" [eval-expression-debug-on-error elisp--eval-last-sexp-fake-value debug-on-error elisp--eval-last-sexp] 4 2273792 "P"] nil)
  apply(ad-Advice-eval-last-sexp #[257 "\204�\303!\207  \303!\n)B\211A  =\204�\211A\211@\207" [eval-expression-debug-on-error elisp--eval-last-sexp-fake-value debug-on-error elisp--eval-last-sexp] 4 2273792 "P"] nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

This seems like an encoding problem but I have no idea what to do with this. I'm more than happy to provide further information.


texts: How can I avoid accidentally editing installed packages while still being able to install new packages?

texts:
I end up looking at source files of packages I have installed fairly often and want to avoid accidentally editing them while I am viewing them.  After looking at https://emacs.stackexchange.com/a/3681/767, I put together this:

(dir-locals-set-class-variables
 'emacs
 '((nil . ((buffer-read-only . t)
           (show-trailing-whitespace . nil)
           (tab-width . 8)
           (eval . (whitespace-mode -1))))))
(dir-locals-set-directory-class (concat user-emacs-directory "elpa") 'emacs)
(dir-locals-set-directory-class
 (locate-dominating-file (locate-library "winner") "lisp") 'emacs)

This worked fine until I went to install a new package.  At that point, the machinery kicks in to create autoloads and then fails to write them because they are considered to be read-only.

I suspect I could do something with defadvice but maybe my whole approach needs to be rethought.  Has anyone else already solved this?


texts: ESS failed to run: ess-s-define-runners is void

texts:
After upgrading packages in emacs, I have the following error message when trying to run R (M-x R): Symbol's function definition is void: ess-s-define-runners.
I can't find where the error is. Here's my ESS set-up in my init file, but I don't think it's coming from there:

(setq ess-eval-visibly-p nil)
(use-package polymode
:ensure f
:init (require 'poly-R)
      (require 'poly-markdown)
      (require 'poly-noweb)
:config
(add-to-list 'auto-mode-alist '("\\.md" . poly-markdown-mode))
(add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode)))
(add-hook 'ess-R-post-run-hook 'smartparens-mode)
(global-set-key (kbd "C-S-m") (lambda () (interactive) (insert " %>% ")))


texts: Make isearch skip folded content in org-mode

texts:
Q: How can I tell isearch to ignore the contents of folded blocks by default in org-mode buffers?

More specifically, I'd like isearch to ignore contents of comment blocks and drawers: When authoring documents in org-mode I often use comment blocks and custom drawers to store different kinds of notes about the text I am writing. I keep them folded by default to make sure their contents don't distract me:

(add-hook 'org-mode-hook #'org-hide-block-all)

This works really well, but won't stop org-mode from expanding these blocks if they contain matches for a string I am isearching.


texts: Change async-shell-command with a synchronous command keeping the dynamically displayed buffer

texts:
I have this snippet of code:

(async-shell-command
 (concat "perl myscript.pl " (buffer-name))
 (read-string "RETURN: ")
 (with-temp-file "file.new"
   (insert-file-contents "file.new")
   (perform-replace "REGEXP"
            "REPLACEMENT"
            nil nil nil 1 nil (point-min) (point-max))))

This makes my perl script run on the file visited by buffer and returns a file file.new. I can see the stdout displayed  dynamically  in the buffer \*Async Shell Command\*, step by step. Then I need to perform some replacements in file.new. Because of the asyncronicity of the process I need to put a read-string to pause my elisp program.

I'd like to sobstitute the async-shell-command with a synchronous command but keeping the dynamically diplayed buffer.

Addedum. Here's another little example of what I mean:

(async-shell-command "echo \"bye\"; sleep 3; echo \"bye\"")

this code will display the first "bye" string in the  *Async Shell Command* buffer, than the second "bye" string will be displayed after 3 seconds.

I'd like to have shell-command behaving the same, e.g.:

(shell-command "echo \"bye\"; sleep 3; echo \"bye\"")

I tried to modify the async-shell-command this way:

(defun my-sync-shell-command (command &optional output-buffer error-buffer)
  "DocString"
  (interactive
   (list
    (read-shell-command "Sync shell command: " nil nil
            (let ((filename
                   (cond
                (buffer-file-name)
                ((eq major-mode 'dired-mode)
                 (dired-get-filename nil t)))))
              (and filename (file-relative-name filename))))
    current-prefix-arg
    shell-command-default-error-buffer))
  ;; I commented these lines to remove the ending "&" sign:
  ;; (unless (string-match "&[ \t]*\\'" command)
  ;;   (setq command (concat command)))
  (shell-command command output-buffer error-buffer))

but it didn't work.


texts: (progn (scroll-up 1) (goto-char 0)) is different from (scroll-up 1) then (goto-char 0)

texts:
In any buffer, try to eval-expression the expression (scroll-up 1) and then eval (goto-char 0).  The window scrolls up, then point is moved to the beginning of the buffer.  Now, try eval-ing (progn (scroll-up 1) (goto-char 0)).  Here, point is not moved to the beginning of the buffer; the window scrolls up 1 line and point is moved to the middle of the screen.

Why is running (scroll-up 1) and then running (goto-char 0) any different from running (progn (scroll-up 1) (goto-char 0))?


texts: How to find usages of a variable/function etc in Python?

texts:
So going to the declaration is great. However I want frequently to go the other way. There used to be a way to do this with one of the older ada-modes, but I've not seen anything in the python support that does this.

Is this possible in emacs and if so is there a package for it?


texts: Can I force erlang-mode to use 4-spaces for indents?

texts:
I'm working within a small team writing Erlang. I'm the only developer using Emacs. The Erlang code the rest of the team outputs is indented using multiples of 4 spaces. For example:

store_data_somewhere(Data) ->
    StandardProplist = fun(Arg1, Arg2) ->
        Parameters = [
            {param1, Arg1},
            {param2, Arg2}
            ],
        {ok, Parameters}
    end,
    PreparedStatement = storage:prepare(
        Data,
        StandardProplist
        ),
    db:transaction(PreparedStatement).

Currently erlang-mode would format as follows:

store_data_somewhere(Data) ->
    StandardProplist = fun(Arg1, Arg2) ->
                               Parameters = [
                                             {param1, Arg1},
                                             {param2, Arg2}
                                            ],
                               {ok, Parameters}
                       end,
    PreparedStatement = storage:prepare(
                          Data,
                          StandardProplist
                         ),
    db:transaction(PreparedStatement).

Is there any way I can coerce my emacs so that it follows the same rules as my colleagues' editors and conforms to the company style-guide?


texts: Emacs hangs after describe-variable on package-archive-contents

texts:
When I try run describe-variable on package-archive-contents C-h v package-archive-contents emacs hangs. It hangs at least 5 minutes, maybe forever (I did not wait any longer).

Seems like Esc : (print package-archive-contents) also almost hangs.. It outputs an enormous string to message buffer after a minute. When trying to copy the string to the clipboard emacs hangs again..

I am running Emacs version 25.1 on Ubuntu 16.10.

Running C-h v package-archives gives current value:

 (("gnu" . "http://elpa.gnu.org/packages/") ("marmalade"
 . "http://marmalade-repo.org/packages/") ("melpa"
 . "http://melpa.milkbox.net/packages/") ("org"
 . "http://orgmode.org/elpa/"))


texts:
Is it possible to have in the completion window the list of ALL tags ?
TAG1 + TAG2 + TAG3 + TAG4+ TAG5


texts: Make Org Table with #+NAME label collapsible

texts:
I have an org table with has a NAME label like:

#+NAME: TBL
| Foo | Bar |

In the past I have always been able to expand and collapse the whole table by cycling using TAB on the #+NAME line.

However in the latest version of emacs (26.1), this doesn't seem to work.

If I replace #+NAME: TBL with #+RESULTS: TBL it works fine.  Pressing TAB on the RESULTS line hides the table, pressing it again reveals the table once more.

Is there an org setting to define which which blocks can be expanded/folded, or some other requirement I'm missing?

Thanks


texts: Set magit to pull with rebase by default

texts:
Recent versions of Magit (>=2.3) have snazzy new popups with variables that feature more than two options.

Here, r cycles between the three values: true, false, and default:false.

I almost always pull with rebase, so how can I make the default default:true instead?


texts:
Sometimes when I am using helm, I want to make the helm completion buffer as big as possible. I know that helm-enlarge-window will make the window grow by 1 line, but this is awkward and still doesn't quite achieve the desired result.  I also know that setting (setq helm-full-frame t) will make helm open full-frame by default, but I don't want all helm buffer full frame all the time.

What I really want is to bind a key that will instantly expand the helm completion buffer to full-frame.  I have tried this (where *helm XYZ* is the name of the current helm buffer):

 (with-current-buffer "*helm XYZ*" (delete-other-windows))

but I get the error "Can't expand minibuffer to full frame."  Any other suggestions for how I can toggle the helm buffer to be full frame?


texts: terminal emulator for ncurses applications

texts:
What is the recommended terminal emulator in emacs to use ncurses applications? I use things like wicd-curses, cmake and other applications with rich ncurses interfaces and I am having trouble in finding an appropriate configuration where keyboard interaction works well and terminal content is not accidentally scrambled.

Thank you.


texts:
I'm using GNU Emacs 26.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.5) of 2016-12-20, with arch linux (antergos), I want to start with the option tcp  server, so I added and assigment to the variable server-use-tcp,

(setq server-use-tcp t)

and I get this warning:

In toplevel form:
init.el:15:7:Warning: assignment to free variable ‘server-use-tcp’

Is this variable deleted?, or is the wrong way to this? or what library I need to require before setting that variable?


texts: Highlighting text in open (displayed) buffers/windows -- searching for text from one buffer in another

texts:
Right now, I have my Emacs frame vertically split, and am looking at two different buffers in the two windows.

I'd like to go to a word in one buffer, hit some keys, and have the ocurrences of that word (if any) highlighted in the other buffer, scrolling to it if necessary.

Is there a way to do that?

In the screenshot above, with my cursor just before "bar" in the left buffer, I'd like to be able to <do something> and quickly see where "bar" is in the right buffer.

Note: This is related to How do I find text across multiple open buffers? in the sense that, if I could do an isearch across the "other" buffer, it would do what I want. But none of the answers there are exactly what I want:

The occur based solutions open a new window that shows matching lines, while I'd like to keep my two windows still displayed -- I'm actually going to be looking in the other buffer for context around the match, so showing only the matching line is not very helpful.
multi-isearch-buffers requires me to specify the list of buffers every time I want to do this search (a lot of times), instead of automatically picking it up as the two displayed buffers. More importantly, when I start from one window and perform the isearch, when it finds the match in the other buffer it displays that buffer in this window, so that both windows display the same (other) buffer. Then C-g puts everything back, and I can't see the word highlighted in the other buffer any more.
icicle-search has so many features that one of them may be able to do this, but I wasn't able to find anything after a cursory look at the documentation.


texts: Distraction free writing mode and vertically centered?

texts:
One feature, that I really adored in Ulysses is it's typewriting scroll center lock mode (for the lack of a better description). It would keep the line centered, no matter if the cursor is at the beginning of a file or anywhere else:

I can get vertical center in Emacs just fine, but not at the beginning of a buffer:

Is there any way to get the current line centered, even at the beginning of the buffer? So, centered-cursor-mode is almost perfect, except for beginning of the buffer. Or is that a limitation of how Emacs works?


texts: Google-like search (with several keywords) in local (project) files

texts: Is there a minor-mode/function that let me search through a project with several keywords, in the way I a search for files on google. The result should be, like in search engines on the web, a list of files with the most relevant result at the top.


texts: How do you pass a variable in to a lambda?

texts:
How can I pass a stringvariable in to this function, so
that instead of printing "This is a test",
it prints "This is a value-of-variable"

(async-start
   ;; What to do in the child process
   (lambda ()
     (message "This is a test")
     (sleep-for 3)
     222)

   ;; What to do when it finishes
   (lambda (result)
     (message "Async process done, result should be 222: %s" result)))

Update: I tried the answer suggested by @Tobias. Didn't work. Here's my code

;; ~/prelude/personal.el
(eval-after-load 'elfeed-search
  '(define-key elfeed-search-mode-map "d" #'my/baa))

;; comment
(defun my/baa ()
  (interactive )
  (let ((var "value-of-variable"))

  ;;(message "here %s" (format-time-string "%d/%m/%Y %H:%M:%S" (current-time)))
  (async-start
   ;; What to do in the child process
   (lambda ()
     (message "This is a %s" var)
     (sleep-for 2)
     var)

   ;; What to do when it finishes
   (lambda (result)
     (message "%s Async process done, result should be 222: %s" (format-time-string "%d/%m/%Y %H:%M:%S" (current-time)) result))))

  (next-line)
  ))

To test it, I would place point/cursor on a elfeed RSS feed item,
and press letter d. I see in the minibuffer:

error in process sentinel: Symbol’s value as variable is void: var

By the way, as you can see, I suck at elisp indentation. How can I tell emacs to fix the indentation of the above code block.

Here's some background on what I'm trying to achieve. I have a RSS feed that has a steady steam of new articles. The feed lacks some key information. Let's say the feed is about companies listed in NYSE, and I would like to see the current stock price of the feed item. Since this info is available via the web via a seperate curl call, my solution is to bind letter "d" to an elisp function "my/baa". This function is non blocking. It is passed a reference to the currently selected elfeed item. When the (async) function returns, it prepends the stock price value to the line in the elfeed-search mode buffer. This is done through the "meta attribute" mechanism provided by elfeed. basically, any feed item can have a meta information. so the async function adds a meta inf to the elfeed item, and then triggers a ui update/refresh. I can hold down the d key press, and this will trigger a bunch of async's to fetch multiple http requests to get multiple stock quotes. this is non blocking. when the function returns, the display will get updated. each finish of an async function will trigger a redraw of the elfeed-search buffer.

Update 2:
Tyler said the comma and backtick is crucial, so I added them, but still
get the same error. Here's my edited code:

;; comment
(eval-after-load 'elfeed-search
  '(define-key elfeed-search-mode-map "d" #'my/baa))

;; comment
(defun my/baa ()
  (interactive)
  (let ((var "value-of-variable"))

  (async-start
   ;; What to do in the child process
   `(lambda ()
     (sleep-for 3) ;; future curl call
     ,(format "This is a %s" var))

   ;; What to do when it finishes
   (lambda (result)
     (message "Async process done, result should be something: %s"
              result))))

  (next-line))


texts: Regex: Only match base.extension filenames

texts:
I would like to match all filenames with only one dot in them:

(re-search-forward "[a-z0-9A-Z]?+\\.dsp$")

bdsp
plop.dsp.zzz
plop.1.dsp
plop.dsp

Here, the regexp matches plop.1.dsp, but it should ignore that and match nothing but the last line, plop.dsp.

Any Elisp regexp gurus around to enlighten me?


texts: switch-to-buffer from org mode code block

texts:
Evaluating a code block containing (switch-to-buffer "test-buffer") does not display test-buffer. It creates the buffer, but it does not switch to it.
#+BEGIN_SRC emacs-lisp
  (switch-to-buffer "test-buffer")
#+END_SRC

#+RESULTS:
: #<buffer test-buffer>

Evaluating the the function within the code block, running eval-last-sexp, does display the buffer.
I cannot find any switches or header arguments controlling this behaviour, which might well be intended.
From what I can gather this is a more more specific instance of the same issue.
How can I obtain the desired behaviour?


texts: How to make Company mode be case-sensitive on plain Text?

texts:
By default, Company mode seems to convert every prediction into lower case.

E.g:

  HelloWorldOfGoo
  HelloWorldOfEmacs
  ->
  Hell
  [Helloworldofgoo]  //Company prediction
  [Helloworldofemacs]

This is not very practical for case sensitive programming languages without a special backend. How can I make company mode case sensitive?


texts: How to update org-mode default template?

texts: I use C-c C-e -> # -> default to insert the default template for org-export. But some of the value of the options are not what I want. How could I modify the default template (change values or add more options)?


texts: How to change the name of a variable in a function within a selection?

texts: I want to use Ctrl-space at the start of a function, and at the end of a function to select the area of the function and then change the name of a variable var1 to var2. How to do this?


texts: How do I open an ansi-term on a remote server via Tramp?

texts: I am editing a file on a remote server via Tramp, and I decide that I want to open up an ansi-term session on the remote server (as opposed to relying on shell-command). How do I do this? When I run ansi-term, it just opens up a new session on my local computer.


texts: Elisp - Activate and Deactivate Linum-Mode when Goto-Line is Triggered

texts:
I switched to Emacs from Vim and because of Vims functionality of giving keys a prefix, (for example to jump up several lines etc.) i installed relative-linum-mode right away.

Now i found out about Emacs native functionality of jumping to a specific line with M-g M-g (and passing the line number in the minibuffer; the function is called goto-line) and find that much more useful than giving a prefix to C-n or C-p, which is of course not a functionality exclusive to Vim, but i found that to be too tedious in Emacs after all... Maybe i just didn't get used to it.

Now my idea is to have line numbers deactivated most of the time because i find that to look a lot cleaner, but when i press M-g M-g to activate linum-mode, passing the desired line number and after pressing enter and jumping to that line to deactivate linum-mode

Can i bind that to M-g M-g somehow? I know how to rebind keys but i can't figure out how (and if) my desired behavior is possible!


texts: How to make auto-completion case sensitive?

texts:
spacemacs default configuration enables auto-completion, however by default its case insensitive.

How to make auto-complete case sensitive (specifically using a spacemacs configuration)?


texts: Can I make it so that an org-capture prompt "%^{greek}" automatically switches the minibuffer input method to Greek?


texts: How to change size of font in echo area for org-mode entries?

texts:
I have the following configuration using org-superstar:
(use-package org-superstar
  :after org
  :hook (org-mode . org-superstar-mode)
  :init
  ;; copiado de https://github.com/integral-dw/org-superstar-mode/blob/master/DEMO.org#latex-style-headings
  ;; Titles and Sections
  ;; hide #+TITLE:
  (setq org-hidden-keywords '(title))
  ;; set basic title font
  (set-face-attribute 'org-level-8 nil :weight 'bold :inherit 'default)
  ;; Low levels are unimportant => no scaling
  (set-face-attribute 'org-level-7 nil :inherit 'org-level-8)
  (set-face-attribute 'org-level-6 nil :inherit 'org-level-8)
  (set-face-attribute 'org-level-5 nil :inherit 'org-level-8)
  (set-face-attribute 'org-level-4 nil :inherit 'org-level-8)
  ;; Top ones get scaled the same as in LaTeX (\large, \Large, \LARGE)
  (set-face-attribute 'org-level-3 nil :inherit 'org-level-8 :height 1.2) ;\large
  (set-face-attribute 'org-level-2 nil :inherit 'org-level-8 :height 1.44) ;\Large
  (set-face-attribute 'org-level-1 nil :inherit 'org-level-8 :height 1.728) ;\LARGE
  ;; Only use the first 4 styles and do not cycle.
  (setq org-cycle-level-faces nil)
  (setq org-n-level-faces 4)
  ;; Document Title, (\huge)
  (set-face-attribute 'org-document-title nil
                      :height 2.074
                      :foreground 'unspecified
                      :inherit 'org-level-8))

This changes the face for org-level-*, however, I noticed that after putting my pointer on an entry the echo area shows the "entry path" with the same font face:

I had this problem with dasboard-mode, but was easy to fix by activating a function on the dashboard-mode-hook that normalize the font face without changing it in any org-mode buffers displaying the same content:
(defun font-pt-to-height (pt)
  "Transforma una altura en puntos PT a altura de `face-attribute'."
  ;; el valor es de 1/10pt, por tanto 100 seria equivalente a 10pt, etc.
  (* pt 10))

(defun shackra/dashboard-normalize-faces ()
  "Reduce el tamaño de los titulos"
  (face-remap-add-relative 'org-level-3 :weight 'normal :height (font-pt-to-height 13))
  (face-remap-add-relative 'org-level-2 :weight 'normal :height (font-pt-to-height 13))
  (face-remap-add-relative 'org-level-1 :weight 'normal :height (font-pt-to-height 13)))

(use-package dashboard
  :if (not (version<= emacs-version "25.2"))
  :custom
  (initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
  ;; ...
  :config
  (dashboard-setup-startup-hook)
  (add-hook 'dashboard-mode-hook #'shackra/dashboard-normalize-faces))

I would like to know how to do the same for the echo area, I'm not aware of any mode-hook for it.


texts:
I'm trying to write a piece of code that runs a single ERT test programmatically. In the ERT manual, they show an example that creates a test body and then runs the body, like so:

(ert-deftest ert-test-record-backtrace ()
   (let ((test (make-ert-test :body (lambda () (ert-fail "foo")))))
    (let ((result (ert-run-test test)))

But... (ert-run-test won't work with a normal ert-deftest name such as the one shown above, ert-test-record-backtrace. If I try doing that I see an error

(ert-run-test 'ert-test-record-backtrace)
Debugger entered--Lisp error: (wrong-type-argument arrayp my-deftest)

The code (ert-run-tests-interactively) runs the usual ERT function that prompts for tests in the minibuffer.

How can I run one or more ERT tests programmatically? Is it even possible? I'm working on this kind of syntax right now, but it is not working. I think I need to extract the function body value of my-deftest, but I don't know how to do that yet.

(ert-run-test (make-ert-test :body my-deftest))

Update: I tried to put my whole test function inside the make-ert-test format shown in the example above, and was able to run the test. Not pretty code, because of the indenting. And the result was in square brackets, which I don't understand yet. But I can see the value: t in there that I would like to extract. So I'm getting closer.

(setq result
  (ert-run-test
   (make-ert-test :body
                  (lambda ()
                    ;; my ert test code here
                    (should (equal tcoll output))
                    ))))

[cl-struct-ert-test-passed "" (((should ...) :form (equal ... ...) :value t :explanation nil))]

After more experimentation to dig the answer out of the result returned (it was an array), here is the code that gets me to the t that I could see.

(setq data (aref result 2))
(((should (equal tcoll output)) :form (equal ...)) :value t :explanation nil))
(nth 4 (car data))
t

It works, but it seems like a brute force approach because I have to copy my ert-deftest code into a separate lambda function as shown above.


texts: change how initial parenthesis is highlighted

texts: I recently installed a programming package, "Haskell mode," and apparently I changed how "initial parenthesis highlighting" works. I'm used to a quick black/white box superimposed on the initial parenthesis. Now there is a solid colored box that lingers for a while. How do I change this back to the default behavior?


texts: Org-mode export: Resize Plantuml diagram when exporting to PDF and image gets repeated

texts:
I have a simple PlantUML diagram in an org file and I want to export the entire document to pdf. The problem is that the diagram is embedded correctly, but the picture takes up an entire page. SECOND, the image gets input twice--so need to remove the extra copy. So I am trying to figure out how to resize the picture.

The code I am using looks like this.

#+NAME: classdiagram
#+BEGIN_SRC plantuml :width 5cm :height 5cm :file try.png
@startuml
Class01 <|-- Class02
@enduml
#+END_SRC

But when I create the latex and generate the PDF, the PNG file takes up the entire page. I tried to generate a JPG as well, but still no luck.

I tried a few different ways to get this to work like:

#+NAME: classdiagram
#+ATTR_LATEX:  :width 0.6
#+BEGIN_SRC plantuml :file try.png
@startuml
Class01 <|-- Class02
@enduml
#+END_SRC

However, the sticking point seems to be that the Latex that is generated looks like this:

\includegraphics[width=.45\linewidth]{try.png}
\begin{center}
\includegraphics[width=.9\linewidth]{try.png}
\end{center}

NOTE: This image gets imported twice, which also needs to be corrected.

Anyone know the right way to fix this and resize the image?


texts: If I accidentally closed the scratch buffer in Emacs, how do I create a new scratch buffer?


texts:
When I write, for example, (format "The value is %d." fill-column) and type C-c p after it, it outputs a result.

How could I do the same with a shell command? That is, to run a shell command within a emacs buffer in org-mode and insert the result in the same buffer?


texts: Use tramp to play remote videos on the local

texts:
I use tramp to access my phone through termux and locates the Movies directory

  /ssh:termux:/storage/emulated/0/Movies:
  total 162M
  Superbook - In The Beginning - Season 1 Episode 1 - Full Episode (Official HD Version).mp4
  Superbook - In The Beginning - Season 1 Episode 1 - Full Episode (Official HD Version).srt

Upon placing cursor on the video file Superbook*.mp4 and invoke asynchronous execute
    & vlc
with intention to play it.

but get the error report as

/bin/sh: 2: vlc: Permission denied

then try sudo but get the same error report.

/bin/sh: 2: sudo: Permission denied

In fact, Permission denied might be a wrong report, since I have the full privilege to edit or rm the video file.

What's the problem? Is it an alternative to play remote videos from the dired of emacs?

If the videos are local, they play smoothly after strike & vlc.


texts: emacs ivy always selecting default function

texts:
I just started trying out ivy. I took the following example from the ivy tutorial:

(defun my-action-1 (x)
  (message "action-1: %s" x))

(defun my-action-2 (x)
  (message "action-2: %s" x))

(defun my-action-3 (x)
  (message "action-3: %s" x))

(defun mih ()
  (interactive)
  (ivy-read "test: " '("foo" "bar" "baz")
            :action '(1
                      ("o" my-action-1 "action 1")
                      ("j" my-action-2 "action 2")
                      ("k" my-action-3 "action 3"))))

My problem is, no matter which option I select, only the default function is invoked. Say, I selected option "j" above, I still the message:

"action-1 bar"

My expectation was that I would get:

"action-2 bar"

Since I did not make any changes to the code from the tutorial, I think I am missing something here.

Any ideas?


texts: flycheck cannot find python-pylint on macOS

texts:
I have installed pylint with: pip install pylint and it is in the following path: $HOME/miniconda2/bin and I have add the following to my .bash_profile: export PATH="$HOME/miniconda2/bin:$PATH"

But when selection syntax checker for flycheck I get:

Syntax checker in buffer share_queries.py in python-mode:

  python-pylint (disabled)
    - major mode:         `python-mode' supported
    - may enable:         Automatically disabled!
    - executable:         Not found
    - configuration file: Found at "/Users/larsnielsen/.pylintrc"

Flycheck cannot use this syntax checker for this buffer.

Flycheck Mode is enabled.  Use C-u C-c ! x to enable disabled
checkers.

--------------------

Flycheck version: 31snapshot (package: 20161117.144)
Emacs version:    25.1.1
System:           x86_64-apple-darwin16.1.0
Window system:    ns

I am not sure why. Can someone help ?


texts: How to display a visual seconds clock counter -- 10, 9, 8, . . time's up!

texts:
Q:  How, please, can I incorporate a visual seconds counter that will disappear when an option is selected, or when the clock runs out.

Example -- *Messages* buffer

You have 10 seconds to make your selction.
You have 9 seconds to make your selection.
. . .
Time's up!

I have a variable that is called init-variable.  When non-nil, Emacs loads with a full configuration of various user customizations.  When nil, Emacs loads with the equivalent of Emacs -Q -- i.e., no user customizations are loaded.  The function read-char-exclusive has a nice feature for a seconds counter, and I've incorporated that feature into the code snippet below. Option number 1 sets the init-variable to nil; option number 2 or no action result in the default setting of non-nil.

(defvar init-variable t)

(let* (
    (emacs-q (read-char-exclusive nil nil 10)))
  (cond
    ((eq emacs-q ?1)
      (setq init-variable nil)
      (message "Emacs -Q"))
    ((eq emacs-q ?2)
      (message "Regular Loading."))
    (t (message "This is the default.")) ))


texts: is there a way to make compile shell process happen in eshell / "real" shell?

texts:
i wanted to bind a key to a compile and run command, then i found this post, Compile and run single file c++ programs in Emacs[SOLVED]
( last answer)
It works perfectly fine and as intended.
The only problem i am having is: is it possible to run the "compile" process in the eshell or in the shell instead of the "compile" shell?  The problem with the "compile" shell is that i am unable to write anything after the program exited.
For those who dont want to click on the link,here is the elisp function, even tho i dont think it has much to do with the question:
(defun compileandrun()
  (interactive)
  (save-buffer)
  (compile (concat "g++ "  (file-name-nondirectory (buffer-file-name)) " -o " (file-name-sans-extension   (file-name-nondirectory (buffer-file-name))) " && ./" (file-name-sans-extension  (file-name-nondirectory (buffer-file-name)))) t )
(other-window 1)
(end-of-buffer)
)
(add-hook 'c++-mode-hook
          (lambda () (local-set-key (kbd "<f8>") #'compileandrun)))
    ```


texts: org-journal sort entries by date at insert time

texts:
I want to switch from daily files to monthly (or even yearly). The problem I'm facing is: org-journal-new-entry and org-journal-new-scheduled-entry simply append at the bottom of a file. This can result in unsorted days - can this be sorted?.
(extreme) example:
config
(use-package org-journal
  :ensure t
  :defer t
  :bind
  ("C-c n j" . org-journal-new-entry)
  ("C-c n s" . org-journal-new-scheduled-entry)
  :custom
  (org-journal-file-format "%Y-%m.org")
  (org-journal-enable-agenda-integration t)
  :config
  (setq org-journal-dir org-journal-directory)
  (setq org-journal-file-type 'monthly)
  (setq org-journal-date-format " %d/%m/%y - %A")
  (setq org-journal-file-header "#+title: %B Journal")

Then:

Add new scheduled in the future
Add new entry today
Add new entry in the past

Result:
#+title: October Journal
*  08/10/20 - Thursday
  :PROPERTIES:
  :CREATED:  20201008
  :END:
** First: New Scheduled
<2020-10-08>
*  06/10/20 - Tuesday
  :PROPERTIES:
  :CREATED:  20201006
  :END:
** 12:46 Second: new Entry
*  05/10/20 - Monday
  :PROPERTIES:
  :CREATED:  20201005
  :END:
** Third: new scheduled in past
<2020-10-05>

my goal
would be to have entries in the file correctly sorted from top to bottom (basically the oppositve of my result)


texts: Emacs displays raw text instead of unicode

texts:
I'm working on a LaTeX document in emacs (27.1) that contains english as well as sanskrit (devanagari) text. After running aspell on the document, I ran M-x revert-buffer and attempted to save the document, when emacs popped a warning window that said something like "These bytes cannot be written". I may have ignored the warning and written the file in raw-text-unix format. Now when I open the file, I see a bunch of numbers. E.g

I selected the entire text in this file and ran M-x recode-region
Text was really in: utf-8
But was interpreted as: raw-text-unix

After this, emacs displays unicode (devanagari) text as expected but these changes do not persist. Whenever I relaunch emacs and open this file, I just see bytes (and not unicode characters). How do I fix this?
EDIT:
The file command shows the the current file has a non-iso extended-ascii text. This is different from my other latex files. E.g:
✗ file naishadham-chap4.tex # doc with problem
naishadham-chap4.tex: LaTeX document text, Non-ISO extended-ASCII text, with very long lines, with LF, NEL line terminators
✗ file naishadham-chap3.tex
naishadham-chap3.tex: LaTeX document text, UTF-8 Unicode text


texts:
If I use (thing-at-point 'paragraph) (or mark-paragraph, for that matter), the selection isn't necessarily aware only about the empty lines. Especially, with lists and code blocks in org-mode.

So, I need a function which returns the bounds which include everything between surrounding blank lines. How would I do that?

EDIT

So, to clarify, if I do (thing-at-point 'paragraph) here:

#+BEGIN_SRC python
x = 1
y = 2
#+END_SRC

I get:

"x = 1
y = 2
#+END_SRC" <font info>


texts: How can I determine which package is adding .emacs.d to my load-path?

texts:
I have a bunch of packages installed.
One of them is adding ~/.emacs.d to my load-path, which Emacs is (unsurprisingly) complaining about.

I could be incorrect here, but:

Attempting to bisect my set of packages is a slow work, because I'd have to uninstall all my packages, and then re-install only half of them, which means downloading, and a lot of fairly manual work.

Is there an easier way to determine which package is setting the value of load-path?

Extra information:

This doesn't happen when loading emacs with -Q.
I've not changed my config between it working and breaking, only upgrade packages
This doesn't happen if I run emacs without a site-file (--no-site-file), regardless of whether I add --no-site-lisp I confused my flags here.
This doesn't happen if run emacs with --no-init-file. site-file / site-lisp have no effect
GNU Emacs 24.4.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8) of 2015-03-31
Bug Hunter tells me that package-initialise is to blame
grep -aR "'load-path" ~/.emac.d/elpa --include '*el' | egrep -v ':[[:space:]]*;+' | fgrep -v "(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))" gives no results
Removing all my .elc files in ~/.emacs.d/elpa appeared to fix this problem, although it's not a great solution. I'm not going to submit & accept because I've no idea how works or whether it's really a fix. This is easily done with find ~/.emacs.d/elpa -name '*.elc' -delete


texts: realgud pdb-remote and ipdb-remote not working

texts:
I've just set up realgud to use pdb and ipdb. It works fine when running a python process on my own machine. The probblem though is that when running a python process (a Pyramid web app) from within a virtualenv inside a virtual machine (using vagrant), I am setting breakpoints, but they are never being triggered. I know that using pdb-remote or ipdb-remote should work but I just can't figure out how to do so, so any help would be greatly appreciated!

The issue I am having is decsribed here but frankly I don't quite understand it.


texts: Create a template that generates a list of properties to be filled in under a heading?

texts:
I've recently decided to learn how to use Emacs. As I want to learn by using, I thought to use Org mode package as a way to track the books I want to read and the ones I've read. I want to create a template for to list these books.

How can I create a template that automatically generates a given list of properties to be filled in under a heading?

In the properties section of the manual a good example of what I would like to do is given :

 * CD collection
 ** Classic
 *** Goldberg Variations
     :PROPERTIES:
     :Title:     Goldberg Variations
     :Composer:  J.S. Bach
     :Publisher: Deutsche Grammophon
     :NDisks:    1
     :END:

However, what I've understood of emacs and orgmode is that they are meant to ease the task for me and allow me to gain some time doing such a list. Therefore, I would like to have a sort of template that automatically creates the property drawer with all the properties ready to be filled. At every new entry inside the CD collection I would like to get :

** New entry
     :PROPERTIES:
     :Title:
     :Composer:
     :Publisher:
     :NDisks:
     :END:

These properties may be inherited, as described in the manual, or set in a configuration file. I thought to use easy templates but I was not sure it would have been the proper way to do it.

Besides, I would like to have examples of similar lists. I've found a lot of examples about how to implement the gtd method in orgmode but few things about look-like lists.


texts: Command to copy and delete subtree in org-mode

texts:
Is there a command in org-mode that copies and deletes a whole bullet point (with its content)? I use that as a way to move tasks into other sections.

So in other words:

* Task A
   Content
** Task B
   Content
* Task C

I want to be able to easily copy and delete the section 'Task A' so that after execution I would get

* Task C

and I can paste the task subtree under the previous task.

PS: I know I can move the subtree down one task at a time. But I have a long document and I want an easier way of moving the tasks.

Thanks


texts: I am reading this Elisp library and can't figure out what :eval is.


texts:
I'm running a fresh install of Arch Linux and if I try to view a pdf file in doc-view or pdf-view, I get the following error message:

  No PNG support is available, or some conversion utility for pdf files is missing.
  Unable to render file.  View extracted text instead

A quick web search didn't provide any leads as how to resolve this issue - actually, I don't even know what exactly the issue is.


texts: find-grep-dired: find exited abnormally with code 1

texts:
Windows 10, Emacs 25.1, Dired+

I want in Dired to find all files that contain text "UserOptions".

M-x find-grep-dired
In folder ca
UserOptions

And here result:

  find exited abnormally with code 1 at Sat Dec  2 20:57:13


texts: Export HTML inline image results for Jekyll

texts:
I'm trying to follow the recipe for exporting Org-mode documents for processing by Jekyll.  My publishing org-publish-project-alist is configured to place exported html in my _posts directory and take images and place them in _posts/assets with org-publish-attachment.  This modification of directory structure seems to be the root of the problem.

#+BEGIN_SRC python :results value file
  import numpy as np
  import matplotlib.pyplot as plt

  from mpl_toolkits.mplot3d import Axes3D

  p1 = np.array([0,4,4])
  p2 = np.array([4,-4,4])
  p3 = np.array([2,2,-4])

  fig = plt.figure()
  ax = fig.gca(projection='3d')
  ax.set_aspect("equal")

  #draw the arrow
  ax.quiver(p1[0],p1[1],p1[2],p2[0],p2[1],p2[2],length=1.0)
  ax.quiver(p1[0],p1[1],p1[2],p3[0],p3[1],p3[2],length=1.0)

  ax.set_xlim([-5, 5])
  ax.set_ylim([-5, 5])
  ax.set_zlim([-5, 5])

  plt.savefig('../images/hw1-p3.png')
  return '../images/hw1-p3.png'
#+END_SRC

#+RESULTS:
[[file:../images/hw1-p3.png]]

#+BEGIN_EXPORT html

Problem 3 visualisation

#+END_EXPORT

The end result I would like is to have the link to the result of the literal code block automatically generated either such that it is not exported as an inline image (as the relative path is incorrect) and be forced to manually add a correct link for HTML export or have the inline image link transformed such that it is correct.

Org-mode newbie!  Suggestions like "Don't use Jekyll" are fine so long as it is accompanied with an alternative and explanation as to why.  I see some people have written custom Org-mode Jekyll plugins like https://github.com/eggcaker/jekyll-org and am wondering if these are a better route.


texts: text-properties bloat persistent undo files

texts:
I'm using undo-tree with AUCTeX, and I am persisting my undo files like so:

(setq undo-tree-auto-save-history t)

Unfortunately, this regularly results in large (~1MB) undo save files which cause my Emacs to hang when they're loaded. The reason for this is the large number of text-properties that AUCTeX puts on its buffer contents, which bloats the file by orders of magnitude.

Is it safe to remove these properties from the save file, and if so, how can I do so?


texts:
(N00b question.)

Is there command/package/snippet to format elisp code (like in my init file) in a standard(-ish) way, like what Prettier does for JavaScript?

I'm not only concerned about indentation, but keeping lines at max 80 chars, and whatever other general readability things are considered useful.


texts: function to convert python dict arg to kwargs?

texts:
I would like to be able to start with code like this:

def foo(a, b, {"c": 1, 'd': 2, "e": 3}):

then execute some emacs function with my cursor anywhere between the {} characters, and rewrite the code to be:

def foo(a, b, c=1, d=2, e=3):

The complications are (1) there can be any number of keys/value pairs inside the {} construction, and the keys can be quoted with either single or double quotes.  I don't require the values to be anything other than strings or numbers or variables.

Can anyone point me to such a function, or to something similar I could use as a starting point?

Would it be best to write this kind of thing in raw elisp, or is there a recommended refactoring package with higher-level features for building this kind of thing?

Initially I thought I could just use query-replace-regexp, but I think a dynamic number of replacement groups is not supported, and this would be needed to support complication (1).


texts: How can I specify a regex pattern which matches only lines without a specific string?

texts:
How can I specify a regex pattern which matches any line without

"lecture" anywhere in it?
".pdf" at the end?


texts: specify time of day for org-resolve-clocks, not number of minutes

texts:
I can use org-resolve-clocks if I've been away from a task but kept the clock for the task running -- but when I do that and select K ("keeps however many minutes you request and then immediately clock out of that task."), I have to specify a number of minutes.

Instead, I want to specify a time, since usually that's what I remember ("my coworker stopped to ask a question at 10:45"). I'd like a way to get the K functionality, but instead of doing the math to figure out a number of minutes, I want to just type in a time of day.

What would I need to do for that?


texts: Why does Emacs fill-paragraph corrupt this paragraph layout?

texts:
To reproduce what appears to be a bug that I'm encountering, create a new buffer with Emacs 26.1 (Fundamental mode is fine), and paste the following text in:

Without message passing to worry about, there is little need to
make invoking subroutines, be they functions or procedures,
late-bound literally all the time.  For this reason, Ascetic
Programming also dispenses with the idea that everything must
be late-bound.

Highlight the whole paragraph, and type M-x increase-left-margin RET to indent the paragraph four spaces.

Then put point on the W of Without, and perform the following in sequence: C-x f 70 RET M-q

Here's what I see after performing the above:

    Without message passing to worry about, there is little need
    to make invoking subroutines, be they functions or procedures,
    late-bound literally all the time.  For this reason, Ascetic
        Programming also dispenses with the idea that everything
    must be late-bound.

There are two problems that I see:  (1) the paragraph is now indented 8 spaces instead of 4 (this also happens if I ensure point is in column 0 of the first line as well), and (2) Programming is indented way too far.

My goal is to get a nicely filled paragraph that happens to have a left margin of 4.  What am I missing?

Thanks for your help.


texts: Similar to this question, I'd like a tool/minor mode to quickly preview my files by merely having the cursor positioned over them (e.g. the currently selected file is displayed in the active buffer window). I don't care about depressing events and I don't want an overlay. If it's selected, I want it displayed in the active window. Pressing enter and switching to the buffer is too slow to skim through a bunch of raw data files. How could I do this?


texts:
C-x 2
On Split-window-below,

1) i like the cursor/point to be in the other window (newly opened) and not in present window.

2) instead of loading in the current-buffer in the other window, i prefer it to be the previously visited file (or) my first entry in (switch-buffer) (or) C-x b list

3) Does elisp support hooks for methods (split-window-below hook)?


texts: How can I open 'dired' mode from any buffer by ONE hotkey?

texts:
I am using Windows 10 and Emacs 26.1.

Suppose I open some file:

And now I want fast open dired mode. The result must be like this:

I want to do this by ONE hotkey direct from a buffer. E.g. C-x j.
Is it possible?


texts:
(This is a followup and different from Emacs Fixed Layout )
High Level
My typical Emacs Working environment is:
+------------+--------------------------+--------------------------+
| NeoTree    |  Main                    |  Rhs                     |
|            |                          |                          |
|            |                          |                          |
|            |                          |                          |
|            |                          |                          |
|            |                          |                          |
|            |                          |                          |
|            |                          |                          |
|            |                          |                          |
|            |                          |                          |
+------------+--------------------------+--------------------------+

where Main = some *.clj *.cljs file I'm editing, and RHS = cide-repl or cljs repl or eshell
Problem
Sometimes, some emacs functions screw up this layout. Examples: looking up documentation, running cider-debug, showing exceptions, etc ...
What I want:
I would a way to bind some keys, say C-x 1, C-x 2, C-x 3 (yes, I know this is terrible choice, but not focus of question) wherE:
C-x 1 = hide all existing windows, fire up 3-pane setup, with Neotree + last edited clj/cljs file, and RHS = cider-repl
C-x 2 = same as C-x 1, but cljs-repl in RHS
C-x 3 = same as C-x 1, but eshell in RHS
Question:
The main feature I need in this is a function to say:

hide all existing windows

create this three pane setup
How do I do that?

Thanks!
Edit: How is this different from original question:
Original question: how can I force emacs to use this 3 pane setup.
This question: emacs is going to screw up my 3 pane setup. How do I have a three-key recovery shortcut?


texts: Any package for editing i18next locale files?

texts: I am looking for a package that allows editing i18next locale files in emacs.


texts: Are macros expanded when the file is compiled?

texts:
I have a macro that needs to be expanded at every single instance of
its use compile-time.  Is there a way I can specify this to be so
without going through the codebase and carefully wrapping each call
with eval-when-compile?