Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
How do I read an emacs backtrace? I've got one here and I'm not sure where my error is. I was using Org 7.9.3f and today I upgrade emacs to 24.4.1 and it came with Org 8.2.10. I am trying to export an org file to HTML. It was working fine before, but now it will not export. Is there a way to get some line numbers out of that backtrace? It seems like I have a malformed timestamp or time range in my file, but there are thousands of entries I don't know which one is wrong. I can recalculate my clock tables without issue, it's just export that throws an error.

Adbot
ADBOT LOVES YOU

tak
Jan 31, 2003

lol demowned
Grimey Drawer
Try toggle-debug-on-error before you try the export to start the debugger when the error occurs.

The last few lines of the trace show what happened:

code:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("[012]?[0-9]:[0-5][0-9]\\(-\\([012]?[0-9]\\):\\([0-5][0-9]\\)\\)" nil)
  org-element-timestamp-parser()
  org-element-clock-parser(169440)
The top line means that the error encountered was (wrong-type-argument stringp nil) -- in other words, it expected a stringp but encountered a nil value. The source of that error was in string-match, which tried to match the regexp listed with a nil value. The nil value came from org-element-timestamp-parser(), which was called from org-element-clock-parser(169440).

If you M-x describe-function RET org-element-clock-parser, click the link to view the source of the org-element.el file where that function is defined, you can C-s and look for where the function is called. In my version of emacs it's called from line 1569 of org-element.el.

In the source of org-element-timestamp-parser (line 3563 for me), string-match with that regexp is called, and the nil value seems to be from date-start. The variable date-start was set earlier in that defun by the let* expression, in the line (date-start (match-string-no-properties 1)).

match-string-no-properties (NUM) docstring:

quote:

string of text matched by last search, without text properties. NUM specifies which parenthesized expression in the last regexp. Value is nil if NUMth pair didn't match, or there were less than NUM pairs.

So in other words, the previous regexp failed to match anything within the first pair of parentheses in the regexp, which date-start was supposed to be set to.

The difficulty is that org-element-clock-parser and org-element-timestamp-parser act on text at point, so it's difficult to debug without actively debugging it as it's running. Your best bet is to start the debugger and see if you can figure out where in your source file it's having trouble.

Hopefully that helps, I'm still fairly new to elisp so I've been trying to look through the source whenever I can.

PleasantDilemma
Dec 5, 2006

The Last Hope for Peace
Thanks for the detailed answer! I enabled toggle-debug-on-error, but it just results in the same stacktrace that I posted before, i was expecting something interactive. Is there a different way to enable the debugger? I'm running this on Windows 7, does the debugger even run on windows?

pgroce
Oct 24, 2002

PlesantDilemma posted:

Thanks for the detailed answer! I enabled toggle-debug-on-error, but it just results in the same stacktrace that I posted before, i was expecting something interactive. Is there a different way to enable the debugger? I'm running this on Windows 7, does the debugger even run on windows?

Coincidentally, someone whose blog I read just did an article on using Edebug, the Emacs interactive debugger. It uses a slightly different entry mechanism than toggle-debug-on-error, but it's probably a little more what you were looking for.

Specifically regarding org-mode: I've had shenanigans ensue when I upgrade org-mode (as a package, not the built-in version) because it byte-compiles files in a copy of Emacs where the old versions of the symbols are already loaded. This doesn't sound like the case for you, but it's worth being aware of. You should also remove any other copies that might be in the load path -- e.g., in .emacs.d/elpa, or wherever ELPA puts packages on Windows.

Org is the reason I now only upgrade ELPA packages from a clean version of Emacs with almost nothing loaded.

Hollow Talk
Feb 2, 2014

pgroce posted:

Coincidentally, someone whose blog I read just did an article on using Edebug, the Emacs interactive debugger. It uses a slightly different entry mechanism than toggle-debug-on-error, but it's probably a little more what you were looking for.

Specifically regarding org-mode: I've had shenanigans ensue when I upgrade org-mode (as a package, not the built-in version) because it byte-compiles files in a copy of Emacs where the old versions of the symbols are already loaded. This doesn't sound like the case for you, but it's worth being aware of. You should also remove any other copies that might be in the load path -- e.g., in .emacs.d/elpa, or wherever ELPA puts packages on Windows.

Org is the reason I now only upgrade ELPA packages from a clean version of Emacs with almost nothing loaded.

I have had some grief with org-mode on upgrades before as well, so I started simply building it from the git tree itself instead of using ELPA. That way, at least, it just installs it properly (in this case) in /usr/local/share/emacs/site-lisp, and not in an ELPA directory somewhere in my home folder.

tak
Jan 31, 2003

lol demowned
Grimey Drawer

pgroce posted:

I've had shenanigans ensue when I upgrade org-mode (as a package, not the built-in version) because it byte-compiles files in a copy of Emacs where the old versions of the symbols are already loaded. This doesn't sound like the case for you, but it's worth being aware of. You should also remove any other copies that might be in the load path -- e.g., in .emacs.d/elpa, or wherever ELPA puts packages on Windows.
C-u 0 M-x byte-recompile-directory RET <path-to-elpa-dir> RET, It'll often help with odd issues like that. The C-u 0 parameter forces it to bytecompile .el files even if it doesn't already have a .elc.

pgroce posted:

Org is the reason I now only upgrade ELPA packages from a clean version of Emacs with almost nothing loaded.

Probably a good idea regardless, although I can't recall having problems like yours that weren't solved by recompiling everything.

tak fucked around with this message at 09:53 on Nov 30, 2014

leftist heap
Feb 28, 2013

Fun Shoe
Is it possible on Windows to get Emacs to remember my frame size/position on exit?

leftist heap
Feb 28, 2013

Fun Shoe

rrrrrrrrrrrt posted:

Is it possible on Windows to get Emacs to remember my frame size/position on exit?

I found a snippet that does what I want.

http://ck.kennt-wayne.de/2011/jul/emacs-restore-last-frame-size-on-startup

Notorious b.s.d.
Jan 25, 2003

by Reene

rrrrrrrrrrrt posted:

Is it possible on Windows to get Emacs to remember my frame size/position on exit?

Use emacs 'desktop' instead. It will save all of your frames / windows + all open buffers. You can easily set it to save periodically in the background.

http://www.gnu.org/software/emacs/manual/html_node/emacs/Saving-Emacs-Sessions.html

This mess of configuration is optional.
code:
;; Save sessions.
(require 'desktop)
(setq desktop-dirname             "~/.emacs.d/desktop/"
      desktop-base-file-name      "emacs.desktop"
      desktop-base-lock-name      "lock"
      desktop-path                (list desktop-dirname)
      desktop-save                t
      desktop-auto-save-timeout   60
      ;; desktop-files-not-to-save   "^$" ;reload tramp paths
      desktop-load-locked-desktop nil)
(desktop-save-mode 1)

Catalyst-proof
May 11, 2011

better waste some time with you
So helm is pretty awesome, but there's one point at which it's terribly less efficient than smex, which is directory traversal in find-file. With smex, if there was one subdirectory in a path, hitting TAB would take me right through it. With helm, it counts '.' and '..' as part of the traversal options, so I have to hit the first letter of the subdirectory, then TAB. Is there a way around that?

brae
Feb 2, 2006

horse mans posted:

So helm is pretty awesome, but there's one point at which it's terribly less efficient than smex, which is directory traversal in find-file. With smex, if there was one subdirectory in a path, hitting TAB would take me right through it. With helm, it counts '.' and '..' as part of the traversal options, so I have to hit the first letter of the subdirectory, then TAB. Is there a way around that?

You could hide them entirely - there's a varable, helm-boring-file-regexp-list and then another that toggles whether helm uses it: helm-ff-skip-boring-files.

code:
(setq helm-boring-file-regexp-list '("\\.\\.$" "\\.$"))
(setq helm-ff-skip-boring-files t)
I tried that and now they don't show up for me anymore.

leftist heap
Feb 28, 2013

Fun Shoe

Notorious b.s.d. posted:

Use emacs 'desktop' instead. It will save all of your frames / windows + all open buffers. You can easily set it to save periodically in the background.

http://www.gnu.org/software/emacs/manual/html_node/emacs/Saving-Emacs-Sessions.html

This mess of configuration is optional.
code:
;; Save sessions.
(require 'desktop)
(setq desktop-dirname             "~/.emacs.d/desktop/"
      desktop-base-file-name      "emacs.desktop"
      desktop-base-lock-name      "lock"
      desktop-path                (list desktop-dirname)
      desktop-save                t
      desktop-auto-save-timeout   60
      ;; desktop-files-not-to-save   "^$" ;reload tramp paths
      desktop-load-locked-desktop nil)
(desktop-save-mode 1)

Thanks for that. The frame position/size saving is only in 24.4 so I guess I'll have to upgrade.

Catalyst-proof
May 11, 2011

better waste some time with you

brae posted:

You could hide them entirely - there's a varable, helm-boring-file-regexp-list and then another that toggles whether helm uses it: helm-ff-skip-boring-files.

code:
(setq helm-boring-file-regexp-list '("\\.\\.$" "\\.$"))
(setq helm-ff-skip-boring-files t)
I tried that and now they don't show up for me anymore.

Perfect! Thanks.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

Notorious b.s.d. posted:

Use emacs 'desktop' instead. It will save all of your frames / windows + all open buffers. You can easily set it to save periodically in the background.

Is there a way to have it not save open buffers? I tend to close emacs in order to clear out my buffers (I know there are other ways to do that, but MAH WORKFLOW).

midnightclimax
Dec 3, 2011

by XyloJW
I've started dabbling around with org-mode, and I'd like to know if it's possible to resize images inline kinda like the timg tag does within this forum. So far I've found some post saying to put #+Attr.*: width="20px" (20px is just a random number, a relative value would be optimal) before my image like
#+Attr.*: width="20px"
file:~/pic.jpg
but nothing happens, it just shows up like before.

Hollow Talk
Feb 2, 2014

midnightclimax posted:

I've started dabbling around with org-mode, and I'd like to know if it's possible to resize images inline kinda like the timg tag does within this forum. So far I've found some post saying to put #+Attr.*: width="20px" (20px is just a random number, a relative value would be optimal) before my image like
#+Attr.*: width="20px"
file:~/pic.jpg
but nothing happens, it just shows up like before.

Is this for html export? If so, try to put an attribute in front of the link:
code:
#+ATTR_HTML: :width 100px
[[./foo.bar]]
Width takes any of the common html/css units, so you can use px, pt, em or %.

edit: On second thought, this is about inline in the buffer, isn't it? Either way, it seems (perhaps unintuitively) that the ATTR_HTML thing works regardless. Here is what the variable description for org-image-actual-width has to say:

quote:

Should we use the actual width of images when inlining them?

When set to `t', always use the image width.

When set to a number, use imagemagick (when available) to set
the image's width to this value.

When set to a number in a list, try to get the width from any
#+ATTR.* keyword if it matches a width specification like

#+ATTR_HTML: :width 300px

and fall back on that number if none is found.

When set to nil, try to get the width from an #+ATTR.* keyword
and fall back on the original width if none is found.

This requires Emacs >= 24.1, build with imagemagick support.

You can customize this variable.

This variable was introduced, or its default value was changed, in
version 24.4 of Emacs.

edit2: It seems however that inline images don't work with % or em or some such. You also don't have to use ATTR_HTML, but ATTR: :width 100 works as well. Another option would be to just set a default value for org-image-actual-width, use (setq org-image-actual-width '(100)) to make org-mode take into account whatever you set in a separate case-by-case #+ATTR, and otherwise just use that size.

Hollow Talk fucked around with this message at 20:33 on Jan 5, 2015

fishbacon
Nov 4, 2009
wonderful yet strange smell

Avenging Dentist posted:

Is there a way to have it not save open buffers? I tend to close emacs in order to clear out my buffers (I know there are other ways to do that, but MAH WORKFLOW).

Calling desktop-clear when you have re-opened emacs could work. You can also manually delete the list in the .desktop file.

From a cursory look at desktop.el it calls frameset-restore, if you record your frameset in a customize variable or in your init file you can use that for future sessions.

midnightclimax
Dec 3, 2011

by XyloJW

Hollow Talk posted:

Is this for html export? If so, try to put an attribute in front of the link:
code:
#+ATTR_HTML: :width 100px
[[./foo.bar]]
Width takes any of the common html/css units, so you can use px, pt, em or %.

edit: On second thought, this is about inline in the buffer, isn't it? Either way, it seems (perhaps unintuitively) that the ATTR_HTML thing works regardless. Here is what the variable description for org-image-actual-width has to say:


edit2: It seems however that inline images don't work with % or em or some such. You also don't have to use ATTR_HTML, but ATTR: :width 100 works as well. Another option would be to just set a default value for org-image-actual-width, use (setq org-image-actual-width '(100)) to make org-mode take into account whatever you set in a separate case-by-case #+ATTR, and otherwise just use that size.

None of these work (yes it's primarily about inline display in the buffer). I've installed ImageMagick via MacPorts to see if that's the culprit, but I get the same behaviour as before (using the stock mac os x emacs binary).

Hollow Talk
Feb 2, 2014

midnightclimax posted:

None of these work (yes it's primarily about inline display in the buffer). I've installed ImageMagick via MacPorts to see if that's the culprit, but I get the same behaviour as before (using the stock mac os x emacs binary).

The above work on openSUSE with Emacs 24.4.1 with ImageMagick support, but I have not tried this under OS X. My strong suspicion is that the standard Emacs build does not enable ImageMagick support at compile time, which is necessary as far as I know. Do MacPorts have their own version of Emacs, by chance? :saddowns:

midnightclimax
Dec 3, 2011

by XyloJW

Hollow Talk posted:

The above work on openSUSE with Emacs 24.4.1 with ImageMagick support, but I have not tried this under OS X. My strong suspicion is that the standard Emacs build does not enable ImageMagick support at compile time, which is necessary as far as I know. Do MacPorts have their own version of Emacs, by chance? :saddowns:

Yeah, I suspect as much. I'll check Macports, but right now the feature is not essential, I thought it would be just neat to have.

pgroce
Oct 24, 2002
FWIW, Homebrew seems to have optional ImageMagick support in its packaging of Emacs: https://github.com/Homebrew/homebrew/issues/30258

Catalyst-proof
May 11, 2011

better waste some time with you
Is there some kind of function or advice which is run when something is drag-and-dropped onto Emacs' application icon on OS X? I want its behavior for files to be the same as usual, but for directories I want it to open a new frame and present a Sublime-like directory tree and load in directory-specific symbol and file search.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

horse mans posted:

Is there some kind of function or advice which is run when something is drag-and-dropped onto Emacs' application icon on OS X? I want its behavior for files to be the same as usual, but for directories I want it to open a new frame and present a Sublime-like directory tree and load in directory-specific symbol and file search.

Does this help? https://www.gnu.org/software/emacs/manual/html_node/emacs/Mac-_002f-GNUstep-Events.html

Catalyst-proof
May 11, 2011

better waste some time with you

It's a good start, thanks. Interestingly it only seems like there's an ns- event for dragging a file onto a frame, not the icon itself, but that's a small workflow adjustment I can make.

EDIT: Maybe, it seems to apply to both, but I can't seem to actually trigger any behavior when it occurs. Oh well, at least it's a starting point.

EDIT: Okay, using Emacs 24.3.50.1 on Yosemite, built from homebrew, dragging and dropping a file/directory onto the dock icon calls <ns-open-file-line>, and dragging and dropping a file/directory into a frame calls <drag-n-drop>. Wonder why that's so far off from the documentation.

Catalyst-proof fucked around with this message at 23:21 on Jan 7, 2015

tak
Jan 31, 2003

lol demowned
Grimey Drawer
The current stable branch is 24.4.50 and unstable is 24.5.50, could it be that the documentation is for a newer version? (not sure, I'm not familiar with homebrew)

Catalyst-proof
May 11, 2011

better waste some time with you
For all the weird archaic vocabulary Emacs uses, 'lossage' is probably the strangest. I don't even know its etymology.

pgroce
Oct 24, 2002
ISTR someone in this thread developing a JIRA interface. Does anyone here use JIRA through Emacs?

Google reveals a few different projects (e.g.: jira.el, org-jira, jira-rest and, um, another org-jira), but none seem to be actively developed/preferred. I thought I'd poll the congregation before I went too deep down that rathole.

ulmont
Sep 15, 2010

IF I EVER MISS VOTING IN AN ELECTION (EVEN AMERICAN IDOL) ,OR HAVE UNPAID PARKING TICKETS, PLEASE TAKE AWAY MY FRANCHISE

horse mans posted:

For all the weird archaic vocabulary Emacs uses, 'lossage' is probably the strangest. I don't even know its etymology.

Like most things Emacs, it's computer nerd slang from the dawn of time that has been preserved here.

http://www.catb.org/jargon/html/L/lossage.html
https://www.gnu.org/software/emacs/manual/html_node/emacs/Lossage.html

Catalyst-proof
May 11, 2011

better waste some time with you

ulmont posted:

Like most things Emacs, it's computer nerd slang from the dawn of time that has been preserved here.

http://www.catb.org/jargon/html/L/lossage.html
https://www.gnu.org/software/emacs/manual/html_node/emacs/Lossage.html

But why is view-lossage named that when all it does is show keypresses?

AlexG
Jul 15, 2004
If you can't solve a problem with gaffer tape, it's probably insoluble anyway.
From the command help:

quote:

If something surprising happens, and you are not sure what you typed, use C-h l (view-lossage). C-h l displays your last 300 input keystrokes. If you see commands that you don't know, you can use C-h c to find out what they do.
So I think the reasoning is something like, I accidentally typed myself into a weird state, and now I want to find out what I actually typed so that I can fix the brokenness.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
Does anyone have any tips for getting TRAMP to autocomplete with plink.exe? I've looked through the docs, but they are supremely unhelpful.

It'd be killer if it could autocomplete paths on the target machines (e.g. by opening an SSH connection once I typed the hostname and hit tab), but I'd be happy with just autocompleting the hostnames.

midnightclimax
Dec 3, 2011

by XyloJW
Anyone using mu4e as the standard mail client? Worth checking out/not worth the hassle?

aerique
Jul 16, 2008

midnightclimax posted:

Anyone using mu4e as the standard mail client? Worth checking out/not worth the hassle?

I have used it at work in the past and really like it. Nimble and configurable. Definitely worth checking out.

Have been planning to set it up again when there's a slow Friday afternoon at work.

midnightclimax
Dec 3, 2011

by XyloJW

aerique posted:

I have used it at work in the past and really like it. Nimble and configurable. Definitely worth checking out.

Have been planning to set it up again when there's a slow Friday afternoon at work.

How does it compare to mutt? Similar scope of abilities or more basic?

aerique
Jul 16, 2008

midnightclimax posted:

How does it compare to mutt? Similar scope of abilities or more basic?

The base install is more basic than mutt, but mutt doesn't have Emacs behind it.

Mu4e's approach to mail is also different from mutt, see the mu mail tools.

dobbymoodge
Mar 8, 2005

midnightclimax posted:

Anyone using mu4e as the standard mail client? Worth checking out/not worth the hassle?

I found that it slows Emacs down for mailboxes with lots of messages. I have >10,000 unread emails, so you will get better results if you don't sick at email like I do.

I will say that the search function sucks - you can't search message bodies at all as far as I could tell, and you can't search for a phrase, no matter how you quote out the search terms. Just one word at a time.

When the search does work, it's pretty quick, being xapian.

I'm using the Zimbra desktop client right now while I'm between email solutions on Emacs, but I'm planning to switch back to NotMuch once I get some free time. IMO you will get better results for your effort setting up notmuch. Both mu4e and notmuch require some significant tweaking, but notmuch is just more rewarding.

tak
Jan 31, 2003

lol demowned
Grimey Drawer
Does anyone do any sort of calendar/org agenda/contacts/etc. syncing with Google accounts? Does it work well? I've been seeing mixed reports, but can't really find much recent info.

The org-caldav package apparently won't work with Google accounts much longer, since Google will soon deprecate the API they'd been using in favour of OAuth2, which apparently requires the developer to register the library with Google and give them a cell phone number or something.

Notorious b.s.d.
Jan 25, 2003

by Reene

Avenging Dentist posted:

Does anyone have any tips for getting TRAMP to autocomplete with plink.exe? I've looked through the docs, but they are supremely unhelpful.

It'd be killer if it could autocomplete paths on the target machines (e.g. by opening an SSH connection once I typed the hostname and hit tab), but I'd be happy with just autocompleting the hostnames.

Tramp autocompletes paths just fine for me.

I'm using the regular openssh client on linux.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

Notorious b.s.d. posted:

Tramp autocompletes paths just fine for me.

I'm using the regular openssh client on linux.

Yeah, it's probably mainly because I'm using this to remote from Windows, via plink.exe, to my Linux VM. The docs just don't say much about the plink case.

Adbot
ADBOT LOVES YOU

brae
Feb 2, 2006

Avenging Dentist posted:

Yeah, it's probably mainly because I'm using this to remote from Windows, via plink.exe, to my Linux VM. The docs just don't say much about the plink case.

I know you mentioned the documentation sucked, but this this one seems to indicate that for hostname completion, the defaults on *nix look in places like ~/.ssh/known_hosts. Does plink maintain such a file somewhere, maybe? If not, it looks like you might have to write some elisp to get the list of hosts to complete from somewhere.

  • Locked thread